/* Select2 en formularios Frean */
.frean-card .select2-container { width: 100% !important; }
.frean-card .select2-container--bootstrap4 .select2-selection--single {
  height: calc(1.5em + 0.75rem + 2px);
  padding: 0.375rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  background: #fff;
}
.frean-card .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  line-height: 1.5;
  padding-left: 0;
  color: #495057;
}
.frean-card .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 6px;
}
.frean-card .select2-container--bootstrap4.select2-container--focus .select2-selection--single,
.frean-card .select2-container--bootstrap4.select2-container--open .select2-selection--single {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(70, 173, 237, 0.25);
}

/* Flecha Select2: a la derecha y centrada en altura del control */
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
  top: 0 !important;
  bottom: 0 !important;
  height: auto !important;
  right: 0.3rem !important;
  width: 1.25rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b {
  position: static !important;
  top: auto !important;
  left: auto !important;
  margin: 0 !important;
}

/* Flatpickr — calendario Frean */
input.premium-input[type=date].js-frean-date,
input.premium-input.js-frean-date {
  color-scheme: light;
}

.frean-date-alt.premium-input,
input.frean-date-alt {
  cursor: pointer;
}

/* Ocultar input nativo cuando Flatpickr muestra alt (dd/mm/aaaa) */
input.js-frean-date.flatpickr-input:not(.frean-date-alt),
input.premium-input[type=date].flatpickr-input:not(.frean-date-alt),
input.table-filter-date.flatpickr-input:not(.frean-date-alt) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

.table-filter-date-alt {
  min-width: 7.5rem;
}

.flatpickr-calendar {
  border: 1px solid #d9e4ec !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 28px rgba(31, 42, 55, 0.14) !important;
  font-family: inherit;
  padding: 0.35rem;
  overflow: hidden;
}

.flatpickr-months {
  padding: 0.15rem 0.2rem 0.35rem;
}

.flatpickr-months .flatpickr-month {
  height: 2.2rem;
}

.flatpickr-current-month {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--frean-navy, #1e293b);
  padding-top: 0.2rem;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  fill: #64748b;
  padding: 0.35rem;
  border-radius: 8px;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
  background: #eff6ff;
  fill: var(--frean-accent, #46ADED);
}

.flatpickr-weekdays {
  background: transparent;
}

span.flatpickr-weekday {
  color: #94a3b8;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.flatpickr-day {
  border-radius: 8px !important;
  color: #334155;
  font-weight: 600;
  max-width: 36px;
  height: 36px;
  line-height: 36px;
}

.flatpickr-day:hover,
.flatpickr-day:focus {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
}

.flatpickr-day.today {
  border-color: var(--frean-accent, #46ADED) !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
  background: var(--frean-accent, #46ADED) !important;
  border-color: var(--frean-accent, #46ADED) !important;
  color: #fff !important;
  box-shadow: none;
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
  color: #cbd5e1 !important;
}

.frean-form-section--compact .select2-container--bootstrap4 .select2-selection--single,
.orden-form-fields .select2-container--bootstrap4 .select2-selection--single {
  min-height: calc(1.5em + 0.75rem + 2px);
}

/* Componentes ERP — tokens en css/tokens.css (--frean-* = alias) */
body.admin-nav-rail {
  background: var(--ag-nav-page, var(--frean-surface));
  color: var(--frean-text);
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  font-weight: var(--font-weight-regular, 400);
}

.frean-main {
  margin-left: var(--ag-nav-current-width, 4rem);
  margin-top: var(--ag-nav-header-height, 4.25rem);
  min-height: calc(100vh - var(--ag-nav-header-height, 4.25rem));
  padding-top: 0 !important;
  background: transparent;
}

@media (max-width: 767.98px) {
  .frean-main { margin-left: 0; }
}

.frean-brand {
  font-weight: 800 !important;
  letter-spacing: 0.02em;
  color: #fff !important;
  font-size: 1.25rem !important;
}

.frean-nav-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--frean-accent);
  color: #fff !important;
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none !important;
}

.ag-sidebar-link.active,
.ag-sidebar-link.is-active,
.ag-sidebar-link.nav-item-active {
  background: var(--ag-nav-active-bg) !important;
  color: var(--ag-nav-active-color) !important;
  box-shadow: inset 3px 0 0 var(--ag-nav-active-color);
}

.ag-sidebar-link.active > i:first-child,
.ag-sidebar-link.is-active > i:first-child,
.ag-sidebar-link.nav-item-active > i:first-child {
  color: var(--ag-nav-active-color);
}

/* Dense rail: icon-only until hover/expand (AccesoGym pattern) */
#ag-admin-sidebar.ag-nav-dense .ag-sidebar-link {
  justify-content: flex-start;
}

/* Categorías del menú: aire entre último ítem de una sección y el título siguiente. */
.ag-sidebar-list .ag-nav-section {
  position: relative;
  height: 14px;
  min-height: 14px;
  margin: 12px 10px 4px;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(255,255,255,.13);
  pointer-events: none;
}

.ag-sidebar-list .ag-nav-section:first-child {
  margin-top: 2px;
  border-top: 0;
}

.ag-sidebar-list .ag-nav-section span {
  position: absolute;
  top: -7px;
  left: 4px;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  color: rgba(255,255,255,.48);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .09em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity .12s ease, max-width 0s linear .12s;
}

@media (min-width:768px) {
  .ag-admin-sidebar:hover .ag-nav-section,
  .ag-admin-sidebar.is-expanded .ag-nav-section,
  body.ag-nav-sidebar-pinned .ag-nav-section {
    height: 22px;
    min-height: 22px;
    margin: 16px 13px 6px;
    border-top-color: rgba(255,255,255,.09);
  }
  .ag-admin-sidebar:hover .ag-nav-section:first-child,
  .ag-admin-sidebar.is-expanded .ag-nav-section:first-child,
  body.ag-nav-sidebar-pinned .ag-nav-section:first-child {
    margin-top: 2px;
  }
  .ag-admin-sidebar:hover .ag-nav-section span,
  .ag-admin-sidebar.is-expanded .ag-nav-section span,
  body.ag-nav-sidebar-pinned .ag-nav-section span {
    top: -6px;
    max-width: 12rem;
    padding-right: 6px;
    background: var(--ag-nav-surface, #2c2f34);
    opacity: 1;
    transition: opacity .15s ease .04s, max-width 0s;
  }
}

@media (max-width:767px) {
  .ag-sidebar-list .ag-nav-section {
    height: 22px;
    min-height: 22px;
    margin: 16px 13px 6px;
  }
  .ag-sidebar-list .ag-nav-section:first-child {
    margin-top: 2px;
  }
  .ag-sidebar-list .ag-nav-section span {
    top: -6px;
    max-width: 12rem;
    padding-right: 6px;
    background: var(--ag-nav-surface, #2c2f34);
    opacity: 1;
  }
}

.page-header-app h1 {
  font-weight: var(--font-weight-bold, 700);
  font-size: 1.65rem;
  color: var(--frean-text);
  letter-spacing: -0.02em;
}

.frean-card {
  background: #fff;
  border-radius: var(--frean-card-radius);
  box-shadow: var(--frean-card-shadow);
  border: none;
  padding: 1.25rem;
}

/* ——— Formularios de operación (OC, pedidos, etc.) ——— */
.frean-form-oc {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

/* Alta OC/pedido/venta: card hasta el borde de pantalla, scroll interno, botones fijos abajo. */
body.admin-nav-rail main.app-list-page.frean-main:has(.orden-form-layout) {
  height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  max-height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  min-height: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.orden-form-layout) > .container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0.65rem !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.orden-form-layout) .page-header-app {
  flex: 0 0 auto;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.orden-form-layout) form.frean-form-oc,
body.admin-nav-rail main.app-list-page.frean-main:has(.cobro-form-layout) form.frean-form-oc {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

@media (min-width: 768px) {
  html:has(body.admin-nav-rail .orden-form-layout) {
    height: 100%;
    overflow: hidden;
  }
  body.admin-nav-rail:has(.orden-form-layout) {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
}

body.admin-nav-rail main.app-list-page.frean-main:has(.cobro-form-layout) {
  height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  max-height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.cobro-form-layout) > .container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0.65rem !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.cobro-form-layout) .page-header-app {
  flex: 0 0 auto;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.cobro-form-layout) > .container-fluid > .orden-form-alert {
  flex: 0 0 auto;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.cc-layout) {
  height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  max-height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.cc-layout) > .container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0.65rem !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.cc-layout) .page-header-app {
  flex: 0 0 auto;
}

/* Ficha maestro (cliente/proveedor): título fijo, scroll solo del formulario */
body.admin-nav-rail main.app-list-page.frean-main:has(.maestro-form-layout) {
  height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  max-height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.maestro-form-layout) > .container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0.65rem !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.maestro-form-layout) .page-header-app {
  flex: 0 0 auto;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.maestro-form-layout) > .container-fluid > .maestro-form-alert {
  flex: 0 0 auto;
}

.maestro-form-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.maestro-form-card {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.75rem 1rem 0.65rem !important;
  margin-bottom: 0 !important;
}

.maestro-form-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 0.15rem;
}

.maestro-form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.55rem 0.85rem;
  align-items: start;
}

.maestro-form-grid .maestro-field {
  grid-column: span 4;
  margin-bottom: 0 !important;
}

.maestro-form-grid .maestro-field--wide {
  grid-column: span 8;
}

.maestro-form-grid .maestro-field--sm {
  grid-column: span 3;
}

.maestro-form-grid .maestro-field--xs {
  grid-column: span 2;
}

.maestro-form-grid .maestro-field--half {
  grid-column: span 6;
}

.maestro-form-grid .maestro-field--full {
  grid-column: 1 / -1;
}

.maestro-form-grid .maestro-field--cp {
  grid-column: span 3;
}

.maestro-form-grid .maestro-field--iva {
  grid-column: span 5;
}

/* Formas de pago: alta + listado */
.formas-pago-layout {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.75rem;
}

.formas-pago-layout .formas-pago-new {
  flex: 0 0 min(18rem, 100%);
  max-width: 22rem;
}

.formas-pago-layout .formas-pago-list {
  flex: 1 1 18rem;
  min-width: 0;
  min-height: 0;
  margin-bottom: 0;
}

.formas-pago-edit-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.formas-pago-edit-row .form-control {
  flex: 1 1 auto;
  min-width: 0;
}

.formas-pago-edit-row .btn {
  flex: 0 0 auto;
}

/* Caja: dos paneles */
body.admin-nav-rail main.app-list-page.frean-main:has(.caja-layout) {
  height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  max-height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.caja-layout) > .container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0.65rem !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.caja-layout) .page-header-app {
  flex: 0 0 auto;
}

.caja-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 0.75rem;
  overflow: hidden;
}

.caja-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.caja-panel-title {
  flex: 0 0 auto;
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}

.caja-panel .table-shell--sticky {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
}

@media (max-width: 991.98px) {
  .formas-pago-layout {
    flex-direction: column;
  }

  .formas-pago-layout .formas-pago-new {
    max-width: none;
    flex: 0 0 auto;
  }

  .caja-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .caja-panel {
    min-height: 16rem;
  }
}

.maestro-form-grid .form-group label {
  font-size: 0.72rem;
  font-weight: var(--font-weight-medium, 500);
  color: #475569;
  margin-bottom: 0.2rem;
}

.maestro-form-grid .premium-input,
.maestro-form-grid .form-control {
  padding: 0.35rem 0.55rem;
  font-size: 0.9rem;
  height: calc(1.4em + 0.7rem + 2px);
}

.maestro-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.maestro-form-card > .frean-form-actions.frean-form-actions--footer {
  padding: 0.45rem 0 0.2rem;
}

@media (max-width: 991.98px) {
  .maestro-form-grid .maestro-field,
  .maestro-form-grid .maestro-field--wide,
  .maestro-form-grid .maestro-field--half,
  .maestro-form-grid .maestro-field--sm,
  .maestro-form-grid .maestro-field--xs,
  .maestro-form-grid .maestro-field--cp,
  .maestro-form-grid .maestro-field--iva {
    grid-column: span 6;
  }

  .maestro-form-grid .maestro-field--full {
    grid-column: 1 / -1;
  }
}

@media (max-width: 575.98px) {
  .maestro-form-grid .maestro-field,
  .maestro-form-grid .maestro-field--wide,
  .maestro-form-grid .maestro-field--half,
  .maestro-form-grid .maestro-field--sm,
  .maestro-form-grid .maestro-field--xs,
  .maestro-form-grid .maestro-field--full,
  .maestro-form-grid .maestro-field--cp,
  .maestro-form-grid .maestro-field--iva {
    grid-column: 1 / -1;
  }
}

.cc-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0.4rem;
}

.orden-form-alert {
  flex: 0 0 auto;
  margin-bottom: 0.35rem !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.orden-form-layout) > .container-fluid > .orden-form-alert {
  flex: 0 0 auto;
}

.orden-form-layout {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0.4rem;
}

.frean-form-section--compact {
  flex: 0 0 auto;
  padding: 0.5rem 0.75rem !important;
  margin-bottom: 0 !important;
}

.frean-form-section--compact .form-group {
  margin-bottom: 0.35rem;
}

.frean-form-section--compact .form-group label {
  font-size: 0.72rem;
  margin-bottom: 0.12rem;
}

.frean-form-section--compact .form-control,
.frean-form-section--compact .select2-container--bootstrap4 .select2-selection--single {
  min-height: 34px;
  height: calc(1.5em + 0.45rem + 2px);
  font-size: 0.84rem;
  padding: 0.22rem 0.5rem;
}

.frean-form-section--compact .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  line-height: 1.45;
  padding-left: 0;
}

.orden-form-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0 0.55rem;
  margin-left: 0;
  margin-right: 0;
}

.orden-form-fields > .orden-field {
  padding-left: 0;
  padding-right: 0;
  margin-bottom: 0.35rem;
}

.orden-field--proveedor,
.orden-field--cliente {
  flex: 1 1 11rem;
  min-width: 10rem;
  max-width: 26%;
}

.orden-field--fecha {
  flex: 0 0 8.75rem;
  max-width: 8.75rem;
}

.orden-field--moneda {
  flex: 0 0 5.5rem;
  max-width: 5.5rem;
}

.orden-field--cotiz {
  flex: 0 0 5.75rem;
  max-width: 5.75rem;
}

.orden-field--obs {
  flex: 1 1 8rem;
  min-width: 6rem;
}

.orden-field--fecha .form-control,
.orden-field--moneda .form-control,
.orden-field--cotiz .form-control {
  min-height: 30px;
  height: calc(1.35em + 0.35rem + 2px);
  font-size: 0.8rem;
  padding: 0.15rem 0.35rem;
}

.orden-field--moneda .form-control {
  padding-left: 0.25rem;
  padding-right: 0.15rem;
}

.orden-field--proveedor .select2-container--bootstrap4 .select2-selection--single,
.orden-field--cliente .select2-container--bootstrap4 .select2-selection--single,
.orden-field--moneda .select2-container--bootstrap4 .select2-selection--single {
  min-height: 32px;
  height: calc(1.45em + 0.4rem + 2px);
  font-size: 0.82rem;
}

.frean-form-oc .orden-field--fecha,
.frean-form-oc .orden-field--moneda,
.frean-form-oc .orden-field--cotiz,
.frean-form-oc .orden-field--obs {
  flex: 1 1 0;
  min-width: 7.25rem;
  max-width: none;
}

.frean-form-oc .orden-field--fecha .form-control,
.frean-form-oc .orden-field--fecha .form-control.premium-input,
.frean-form-oc .orden-field--fecha .frean-date-alt,
.frean-form-oc .orden-field--moneda .form-control,
.frean-form-oc .orden-field--moneda .form-control.premium-input,
.frean-form-oc .orden-field--cotiz .form-control,
.frean-form-oc .orden-field--cotiz .form-control.premium-input,
.frean-form-oc .orden-field--obs .form-control,
.frean-form-oc .orden-field--obs .form-control.premium-input,
.frean-form-oc .orden-field--moneda .select2-container--bootstrap4 .select2-selection--single {
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  font-size: 0.84rem;
  padding: 0.22rem 0.5rem;
  box-sizing: border-box;
}

.frean-form-oc .orden-field--moneda .select2-container {
  height: 34px;
}

.frean-form-oc .orden-field--moneda .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  line-height: 32px;
  padding-left: 0;
}

@media (max-width: 767.98px) {
  .orden-field--proveedor,
  .orden-field--cliente,
  .orden-field--obs {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .orden-field--fecha {
    flex: 1 1 calc(50% - 0.3rem);
    max-width: calc(50% - 0.3rem);
  }

  .orden-field--moneda,
  .orden-field--cotiz {
    flex: 1 1 calc(25% - 0.45rem);
    max-width: calc(25% - 0.45rem);
  }

  .frean-form-oc .orden-field--fecha,
  .frean-form-oc .orden-field--moneda,
  .frean-form-oc .orden-field--cotiz,
  .frean-form-oc .orden-field--obs {
    flex: 1 1 calc(50% - 0.3rem);
    min-width: 0;
    max-width: none;
  }
}

.orden-form-layout > .table-shell.frean-items-shell,
.frean-items-shell {
  padding: 0 !important;
  margin-bottom: 0 !important;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.frean-items-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.frean-form-actions.frean-form-actions--footer,
.table-bottom-actions.frean-form-actions--footer {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.55rem 1rem 0.65rem;
  border-top: 1px solid #edf1f5;
  background: #fff;
  box-sizing: border-box;
}

.frean-items-shell > .frean-form-subtotal,
.frean-items-shell > .frean-form-actions--footer,
.bom-ver-main-shell > .frean-form-actions--footer,
.operacion-lines-shell > .frean-form-actions--footer {
  flex: 0 0 auto;
}

.frean-items-shell > .frean-form-actions--footer,
.bom-ver-main-shell > .frean-form-actions--footer,
.operacion-lines-shell > .frean-form-actions--footer {
  padding: 0.55rem 1rem 0.65rem;
}

.frean-form-hint {
  flex: 0 0 auto;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #edf1f5;
  border-radius: 0.35rem;
  line-height: 1.35;
}

.frean-form-subtotal {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 1rem;
  padding: 0.4rem 0.75rem 0.15rem;
  font-size: 0.88rem;
  border-top: 1px solid #edf1f5;
}

.orden-field--letra {
  flex: 0 0 4.75rem;
  max-width: 4.75rem;
}

.orden-field--arca {
  flex: 0 0 auto;
  min-width: 7.5rem;
}

.orden-arca-check {
  padding-top: 0.35rem;
  min-height: calc(1.5em + 0.75rem + 2px);
  display: flex;
  align-items: center;
}

.orden-arca-check .custom-control-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

.orden-field--deposito {
  flex: 0 0 9.5rem;
  max-width: 11rem;
  min-width: 0;
  overflow: hidden;
}
.orden-field--deposito .select2-container {
  width: 100% !important;
  max-width: 100% !important;
}

.select2-dropdown.frean-form-select2-dropdown {
  z-index: 2100 !important;
  min-width: 0 !important;
  max-width: min(22rem, calc(100vw - 1.5rem)) !important;
}

.orden-field--numero {
  flex: 0 0 9rem;
  max-width: 12rem;
}

.orden-form-hint {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  line-height: 1.3;
  color: #64748b;
}

.orden-form-hint strong {
  color: #475569;
  font-weight: 650;
}

.frean-form-section-split {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-start;
}

.frean-form-section-split__fields {
  flex: 1 1 18rem;
  min-width: 0;
}

.frean-form-section-split__aside {
  flex: 1 1 12rem;
  max-width: 24rem;
  min-width: 10rem;
  font-size: 0.76rem;
  line-height: 1.45;
  color: #64748b;
  padding: 0.2rem 0 0.2rem 0.65rem;
  border-left: 2px solid #e2e8f0;
}

.frean-form-section-split__aside strong {
  color: #475569;
}

.frean-form-section-split__aside .text-danger {
  display: block;
  margin-top: 0.25rem;
}

@media (max-width: 991.98px) {
  .frean-form-section-split__aside {
    flex: 1 1 100%;
    max-width: 100%;
    border-left: 0;
    border-top: 1px solid #e2e8f0;
    padding: 0.45rem 0 0;
  }
}

.cobro-form-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0.35rem;
}

.cobro-form-toolbar {
  flex: 0 0 auto;
  margin-bottom: 0 !important;
  padding: 0.4rem 0.65rem !important;
}

.cobro-form-split {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.55rem;
  overflow: hidden;
}

.cobro-panel {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--frean-border, #e2e8f0);
  border-radius: 10px;
  background: #fff;
}

.cobro-panel[data-cobro-panel="facturas"] {
  flex: 1.15 1 0;
}

.cobro-panel.is-collapsed {
  flex: 0 0 auto;
  max-width: 14rem;
}

.cobro-form-split:has(.cobro-panel.is-collapsed) .cobro-panel:not(.is-collapsed) {
  flex: 1 1 auto;
}

.cobro-panel-head {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #edf1f5;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.cobro-panel-toggle {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  line-height: 1;
  cursor: pointer;
}

.cobro-panel-toggle:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

.cobro-panel-toggle i {
  transition: transform 0.15s ease;
  font-size: 0.7rem;
}

.cobro-panel.is-collapsed .cobro-panel-toggle i {
  transform: rotate(-90deg);
}

.cobro-panel-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}

.cobro-panel-action {
  flex: 0 0 auto;
  padding: 0.12rem 0.45rem;
  font-size: 0.7rem;
}

.cobro-panel-meta {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--frean-navy, #1e293b);
  font-variant-numeric: tabular-nums;
}

.cobro-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cobro-panel.is-collapsed .cobro-panel-body {
  display: none;
}

.cobro-panel-shell {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cobro-panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.cobro-form-footer {
  flex: 0 0 auto;
}

@media (max-width: 991.98px) {
  .cobro-form-split {
    flex-direction: column;
    overflow: auto;
  }

  .cobro-panel,
  .cobro-panel[data-cobro-panel="facturas"] {
    flex: 1 1 auto;
    min-height: 14rem;
  }

  .cobro-panel.is-collapsed {
    min-height: 0;
    max-width: none;
  }
}

.cobro-form-block {
  flex: 0 0 auto;
}

.cobro-form-block--grow {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cobro-form-block-title {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  margin: 0 0 0.25rem;
}

.cobro-facturas-shell {
  flex: 1 1 auto;
  min-height: 6rem;
  overflow: auto;
}

.cc-filter-bar {
  flex: 0 0 auto;
}

.cc-toolbar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem 0.65rem;
}

.cc-toolbar--header {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.page-header-actions .cc-toolbar--header {
  max-width: 100%;
}

.cc-toolbar-form {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.35rem 0.45rem;
}

.cc-toolbar-form .form-row {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.35rem 0.45rem;
}

.cc-toolbar-form .form-group {
  margin-bottom: 0 !important;
}

.cc-toolbar-form label {
  font-size: 0.65rem !important;
  margin-bottom: 0.08rem !important;
  line-height: 1.1;
}

.cc-toolbar-form .premium-input,
.cc-toolbar-form .form-control {
  padding: 0.2rem 0.4rem;
  height: calc(1.3em + 0.4rem + 2px);
  font-size: 0.8rem;
  min-height: 0;
  width: auto;
  min-width: 8.5rem;
}

.cc-toolbar-form .btn {
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  line-height: 1.2;
}

.cc-saldo-tile {
  flex: 0 0 auto;
  min-width: 8.5rem;
  margin: 0 !important;
  border-left-width: 4px;
  padding: 0.32rem 0.6rem !important;
  box-shadow: none;
}

.cc-saldo-tile .label {
  margin-bottom: 0;
  font-size: 0.58rem;
}

.cc-saldo-tile .value {
  font-size: 0.98rem;
  line-height: 1.15;
}

.cc-saldo-hint {
  display: none;
}

.cc-saldo-tile.dash-kpi--ventas {
  border-left-color: #0d9488;
  background: linear-gradient(135deg, #f0fdfa 0%, #fff 70%);
}
.cc-saldo-tile.dash-kpi--ventas .label { color: #0f766e; }

.cc-saldo-tile.dash-kpi--ctacte {
  border-left-color: #7c3aed;
  background: linear-gradient(135deg, #f5f3ff 0%, #fff 70%);
}
.cc-saldo-tile.dash-kpi--ctacte .label { color: #6d28d9; }

.cc-saldo-tile.dash-kpi--faltante.is-alert {
  border-left-color: #e11d48;
  background: linear-gradient(135deg, #fff1f2 0%, #fff 70%);
}
.cc-saldo-tile.dash-kpi--faltante.is-alert .label { color: #be123c; }

.cc-table-shell {
  flex: 1 1 auto;
  min-height: 0;
}

.cc-summary-row {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.cc-summary-row .stat-tile {
  flex: 0 0 auto;
  min-width: 8rem;
  margin: 0;
}

.operacion-celda-stack--end {
  align-items: flex-end;
  text-align: right;
}

.comprobante-cobros-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.operacion-doc-chip--cobro {
  background: #f1f5f9;
  border-color: #dbe3ec;
  color: #334155;
  gap: 0.45rem;
  max-width: 100%;
}

.operacion-doc-chip--cobro:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.comprobante-cobro-num {
  font-weight: 700;
}

.comprobante-cobro-amt {
  font-weight: 650;
  color: #64748b;
}

.operacion-doc-chip--cobro:hover .comprobante-cobro-amt {
  color: #475569;
}

.comprobante-iva-lines {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.35;
}

.frean-form-section {
  padding: 1rem 1.15rem !important;
  margin-bottom: 0 !important;
}

.frean-form-section-title {
  font-size: 0.72rem;
  font-weight: var(--font-weight-semibold, 600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin: 0 0 0.75rem;
}

.frean-form-section .form-group label {
  font-size: 0.8rem;
  font-weight: var(--font-weight-medium, 500);
  color: #475569;
  margin-bottom: 0.25rem;
}

.frean-duplicate-alert {
  flex: 0 0 auto;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 500;
  background: #fff8e8;
  border-bottom: 1px solid #fde68a;
  color: #92400e;
}

.frean-items-table tbody tr.item-row-duplicate-flash {
  background: #fff8e1 !important;
  box-shadow: inset 0 0 0 2px #f59e0b;
  animation: frean-row-duplicate-pulse 0.55s ease 2;
}

@keyframes frean-row-duplicate-pulse {
  0%, 100% { background: #fff8e1; }
  50% { background: #ffefb0; }
}

.frean-items-table tbody tr.item-row-add td {
  padding: 0.55rem 0.55rem !important;
  border-top: 1px dashed #d8e2ea;
}

tr.item-row-add {
  cursor: pointer;
  background: #fafcfd;
  opacity: 0.72;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

tr.item-row-add:hover,
tr.item-row-add:focus {
  opacity: 1;
  background: #f0f8fd;
  outline: none;
}

.item-row-add-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--frean-accent, #46ADED);
  font-weight: 650;
  font-size: 0.86rem;
}

.item-row-add-label .fa-plus {
  font-size: 0.75rem;
}

.item-row-add-placeholder {
  color: #cbd5e1;
  text-align: right;
  display: block;
  font-size: 0.9rem;
  user-select: none;
}

.frean-prod-option .frean-prod-code {
  font-weight: 700;
  color: #334155;
}

.frean-prod-option .frean-prod-desc {
  color: #64748b;
}

.frean-prod-option {
  display: flex;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  flex-wrap: wrap;
  width: 100%;
}
.frean-prod-option .frean-prod-code,
.frean-prod-option .frean-prod-desc {
  flex: 0 1 auto;
}
.frean-prod-stock {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: #64748b;
}
.frean-prod-stock.is-ok {
  color: #15803d;
}
.frean-prod-stock.is-reserved {
  color: #b45309;
}
.frean-prod-stock.is-empty {
  color: #dc2626;
}
.select2-dropdown.frean-prod-dropdown .select2-results__option--highlighted .frean-prod-stock.is-ok {
  color: #166534;
}
.select2-dropdown.frean-prod-dropdown .select2-results__option--highlighted .frean-prod-stock.is-reserved {
  color: #92400e;
}
.select2-dropdown.frean-prod-dropdown .select2-results__option--highlighted .frean-prod-stock.is-empty {
  color: #b91c1c;
}

.select2-container--bootstrap4.frean-prod-select2 .select2-selection--single {
  min-height: 36px;
}

.select2-dropdown.frean-prod-dropdown {
  border-color: #dce7ee;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
  z-index: 1090;
}

.select2-dropdown.frean-prod-dropdown .select2-search--dropdown {
  padding: 0.45rem 0.5rem 0.35rem;
}

.select2-dropdown.frean-prod-dropdown .select2-search__field {
  border: 1px solid #dce7ee;
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  font-size: 0.86rem;
}

.select2-dropdown.frean-prod-dropdown .select2-results__option {
  padding: 0.4rem 0.55rem;
  font-size: 0.86rem;
  color: #334155;
}

.select2-dropdown.frean-prod-dropdown .select2-results__option--highlighted,
.select2-dropdown.frean-prod-dropdown .select2-results__option--highlighted[aria-selected] {
  background: #eaf5fc !important;
  color: #334155 !important;
}

.select2-dropdown.frean-prod-dropdown .select2-results__option--highlighted .frean-prod-code {
  color: #1a7aad !important;
}

.select2-dropdown.frean-prod-dropdown .select2-results__option--highlighted .frean-prod-desc {
  color: #475569 !important;
}

.select2-dropdown.frean-prod-dropdown .select2-results__option[aria-selected=true] {
  background: #f0f8fd;
  color: #334155;
}

.select2-dropdown.frean-prod-dropdown .select2-results__option[aria-selected=true].select2-results__option--highlighted {
  background: #dff0fa !important;
}

.frean-items-table .col-producto {
  min-width: 14rem;
}

.frean-items-table .col-cant,
.frean-items-table .col-precio {
  width: 7.5rem;
}

.frean-items-table .col-accion {
  width: 2.75rem;
  text-align: center;
}

.frean-items-table .form-control {
  font-size: 0.86rem;
  min-height: 36px;
}

.frean-items-table .select2-container--bootstrap4 .select2-selection--single {
  min-height: 36px;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

#items-table .select2-container {
  min-width: 100%;
  width: 100% !important;
}

.btn-item-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #f0c4c0;
  border-radius: 8px;
  background: #fff8f7;
  color: #c34b42;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.btn-item-remove:hover:not(:disabled):not(.is-disabled) {
  background: #fdecea;
  border-color: #e8a8a3;
  color: #b91c1c;
  transform: translateY(-1px);
}

.btn-item-remove:disabled,
.btn-item-remove.is-disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.frean-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.15rem 0 0.35rem;
}

/* Gana a .frean-form-actions (padding horizontal 0) para no pegar botones al radio de la card */
.frean-form-actions.frean-form-actions--footer,
.frean-items-shell > .frean-form-actions--footer,
.bom-ver-main-shell > .frean-form-actions--footer,
.operacion-lines-shell > .frean-form-actions--footer,
.cobro-form-layout > .frean-form-actions--footer,
.cheque-imputar-layout .frean-form-actions--footer {
  padding: 0.55rem 1rem 0.65rem;
}

.frean-form-actions .btn-app-blue {
  min-height: 38px;
}

.frean-form-actions-hint {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-left: auto;
}

@media (max-width: 767.98px) {
  .frean-form-actions-hint {
    width: 100%;
    margin-left: 0;
  }
}

/* La barra superior ya reserva su propia altura; evita duplicar el espacio
   vertical heredado del estilo reutilizable de listados. */
.frean-main .page-header-app {
  margin-bottom: 0.75rem !important;
  gap: 0.75rem 1.25rem;
  align-items: center;
}

.frean-main .page-header-app h1,
.frean-main .page-header-app p {
  margin-bottom: 0 !important;
}

/* Formularios de alta/edición: centrados sin afectar formularios de ancho completo. */
.frean-main form.frean-card[style*="max-width"] {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 992px) {
  .frean-main form.frean-card[style*="max-width"] {
    padding: 1.5rem 1.65rem;
  }
}

.btn-app-blue {
  background: var(--frean-accent) !important;
  border-color: var(--frean-accent) !important;
  color: #fff !important;
  font-weight: 700;
  border-radius: 12px;
  padding: 0.55rem 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-app-blue:hover {
  background: var(--frean-accent-dark) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(70, 173, 237, 0.35);
  color: #fff !important;
}

.btn-app-red {
  background: linear-gradient(135deg, #e5736a, #d85b52) !important;
  border-color: #d85b52 !important;
  color: #fff !important;
  font-weight: 700;
  border-radius: 12px;
  padding: 0.55rem 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-app-red:hover {
  background: linear-gradient(135deg, #d85b52, #c34b42) !important;
  border-color: #c34b42 !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(216, 91, 82, 0.35);
  color: #fff !important;
}

.btn-app-green {
  background: linear-gradient(135deg, #3ddc84, #2ecc71) !important;
  border-color: #2ecc71 !important;
  color: #fff !important;
  font-weight: 700;
  border-radius: 12px;
  padding: 0.55rem 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-app-green:hover {
  background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
  border-color: #27ae60 !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(46, 204, 113, 0.35);
  color: #fff !important;
}

.btn-app-orange {
  background: linear-gradient(135deg, #f0b429, #e3a008) !important;
  border-color: #e3a008 !important;
  color: #fff !important;
  font-weight: 700;
  border-radius: 12px;
  padding: 0.55rem 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-app-orange:hover {
  background: linear-gradient(135deg, #e3a008, #c98b06) !important;
  border-color: #c98b06 !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(227, 160, 8, 0.35);
  color: #fff !important;
}

.premium-input, .form-control.premium-input {
  height: 42px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.premium-input:focus {
  border-color: var(--frean-accent);
  box-shadow: 0 0 0 3px rgba(70, 173, 237, 0.22);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-tile {
  background: #fff;
  border-radius: var(--frean-card-radius);
  box-shadow: var(--frean-card-shadow);
  padding: 1.15rem 1.25rem;
  border-left: 4px solid var(--frean-accent);
  min-width: 0;
  overflow: hidden;
}
.stat-tile .label {
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--frean-accent);
  margin-bottom: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-tile .value {
  display: block;
  width: 100%;
  min-width: 0;
  font-size: 1.45rem;
  font-weight: var(--font-weight-bold, 700);
  color: var(--frean-text);
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.15;
  font-variant-numeric: tabular-nums lining-nums;
}

.table-shell {
  background: #fff;
  border-radius: var(--frean-card-radius);
  box-shadow: var(--frean-card-shadow);
  border: 1px solid var(--frean-border);
  padding: 1rem;
  overflow-x: auto;
}

/* Estado restaurado antes del primer render: evita que el nav parpadee cerrado. */
html.ag-nav-prepinned {
  --ag-nav-current-width: var(--ag-nav-expanded-width, 16.5rem);
}

@media (min-width: 768px) {
  html.ag-nav-prepinned .ag-admin-sidebar { width: var(--ag-nav-expanded-width, 16.5rem); }
  html.ag-nav-prepinned .ag-admin-sidebar .ag-sidebar-label {
    opacity: 1;
    max-width: 11rem;
    visibility: visible;
    transform: translateX(0);
  }
  html.ag-nav-prepinned .ag-nav-profile-details,
  html.ag-nav-prepinned .ag-nav-action-label {
    opacity: 1;
  }
}

/* Tablas: sistema visual compartido */
.frean-main .table-shell > h5,
.frean-main .table-shell > h4 {
  color: var(--frean-navy);
  margin: 0 0 0.9rem;
}

.frean-main .table-shell .table,
.frean-main .table-responsive .table {
  width: 100% !important;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
  color: #34495e;
  font-size: var(--table-font-list, 0.91rem);
}

.frean-main .table thead th,
.frean-main table.dataTable thead th {
  background: var(--table-head-bg, linear-gradient(180deg, #f5f9fc 0%, #edf4f8 100%));
  color: var(--frean-navy);
  border-top: 1px solid var(--frean-border) !important;
  border-bottom: 1px solid #d9e4ec !important;
  padding: var(--table-th-pad-list, 0.78rem 0.8rem) !important;
  font-size: 0.75rem;
  font-weight: var(--font-weight-semibold, 600);
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}

.frean-main table.dataTable thead > tr > th.sorting,
.frean-main table.dataTable thead > tr > th.sorting_asc,
.frean-main table.dataTable thead > tr > th.sorting_desc,
.frean-main table.dataTable thead > tr > th.sorting_asc_disabled,
.frean-main table.dataTable thead > tr > th.sorting_desc_disabled {
  position: relative;
  padding-right: 1.55rem !important;
  background-image: none !important;
}

.frean-main table.dataTable thead > tr > th.sorting:before,
.frean-main table.dataTable thead > tr > th.sorting_asc:before,
.frean-main table.dataTable thead > tr > th.sorting_desc:before,
.frean-main table.dataTable thead > tr > th.sorting_asc_disabled:before,
.frean-main table.dataTable thead > tr > th.sorting_desc_disabled:before,
.frean-main table.dataTable thead > tr > th.sorting:after,
.frean-main table.dataTable thead > tr > th.sorting_asc:after,
.frean-main table.dataTable thead > tr > th.sorting_desc:after,
.frean-main table.dataTable thead > tr > th.sorting_asc_disabled:after,
.frean-main table.dataTable thead > tr > th.sorting_desc_disabled:after {
  position: absolute !important;
  right: 0.4rem !important;
  left: auto !important;
  width: 0.7rem;
  font-size: 0.55rem !important;
  line-height: 1 !important;
  opacity: 0.28;
}

.frean-main table.dataTable thead > tr > th.sorting:before,
.frean-main table.dataTable thead > tr > th.sorting_asc:before,
.frean-main table.dataTable thead > tr > th.sorting_desc:before,
.frean-main table.dataTable thead > tr > th.sorting_asc_disabled:before,
.frean-main table.dataTable thead > tr > th.sorting_desc_disabled:before {
  top: 50% !important;
  bottom: auto !important;
  transform: translateY(-105%);
}

.frean-main table.dataTable thead > tr > th.sorting:after,
.frean-main table.dataTable thead > tr > th.sorting_asc:after,
.frean-main table.dataTable thead > tr > th.sorting_desc:after,
.frean-main table.dataTable thead > tr > th.sorting_asc_disabled:after,
.frean-main table.dataTable thead > tr > th.sorting_desc_disabled:after {
  top: 50% !important;
  bottom: auto !important;
  transform: translateY(8%);
}

.frean-main table.dataTable thead > tr > th.sorting_asc:before,
.frean-main table.dataTable thead > tr > th.sorting_desc:after {
  opacity: 1;
  color: var(--frean-accent, #46ADED);
}

.frean-main .table thead th:first-child { border-radius: 10px 0 0 0; }
.frean-main .table thead th:last-child { border-radius: 0 10px 0 0; }

.frean-main .table tbody td {
  padding: var(--table-td-pad-list, 0.72rem 0.8rem) !important;
  border-top: 0 !important;
  border-bottom: 1px solid #edf1f5;
  vertical-align: middle !important;
  line-height: 1.35;
}

.frean-main .table tbody tr:nth-child(even):not([class*="cheque-"]) {
  background: var(--frean-row-alt);
}

.frean-main .table-hover tbody tr {
  transition: background-color 0.14s ease, box-shadow 0.14s ease;
}

.frean-main .table-hover tbody tr:hover {
  background: var(--frean-row-hover) !important;
  box-shadow: inset 3px 0 0 var(--frean-accent);
}

.frean-main .table tbody tr:last-child td { border-bottom: 0; }
.frean-main .table tbody td:empty::after { content: "—"; color: #a7b2bc; }

/* ========== Modelos de tabla Frean (reutilizar en todo el proyecto) ==========
 * --list  : listados DataTables (shell sticky). Densidad por defecto del .table.
 * --lines : detalle readonly (líneas de OC/pedido/remito/OP/factura).
 * --items : formularios editables (filas con inputs / Select2 producto).
 * Contenedor scroll con thead sticky: .frean-table-scroll
 */
.frean-table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.frean-table-scroll > table thead th,
.frean-table-scroll .frean-table--lines thead th,
.frean-table-scroll .frean-table--items thead th,
.operacion-lines-scroll .table thead th,
.operacion-lines-scroll .frean-table--lines thead th,
.frean-items-scroll .frean-items-table thead th,
.frean-items-scroll .frean-table--items thead th,
.cobro-panel-scroll .frean-items-table thead th,
.cobro-panel-scroll .frean-table--items thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--table-head-bg, linear-gradient(180deg, #f5f9fc 0%, #edf4f8 100%));
  box-shadow: 0 1px 0 var(--table-head-border, #e2e8ef);
}

/* Modelo list (documental; hereda densidad de .frean-main .table) */
.frean-table--list {
  font-size: var(--table-font-list, 0.91rem);
}

/* Modelo lines — detalle compacto */
.frean-table--lines,
.operacion-lines-scroll .table {
  font-size: var(--table-font-lines, 0.84rem);
  margin-bottom: 0;
}

.frean-table--lines thead th,
.frean-table--lines tbody td,
.operacion-lines-scroll .table thead th,
.operacion-lines-scroll .table tbody td {
  padding: var(--table-td-pad-lines, 0.32rem 0.5rem) !important;
}

.frean-table--lines thead th,
.operacion-lines-scroll .table thead th {
  padding: var(--table-th-pad-lines, 0.62rem 0.7rem) !important;
  font-size: 0.75rem;
}

/* Modelo items — filas editables (alias de .frean-items-table) */
.frean-table--items,
.frean-items-table {
  margin-bottom: 0;
  font-size: var(--table-font-items, 0.88rem);
}

.frean-table--items thead th,
.frean-items-table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  border-top: 0;
  background: var(--table-head-bg, linear-gradient(180deg, #f5f9fc 0%, #edf4f8 100%));
  padding: var(--table-th-pad-items, 0.55rem 0.55rem) !important;
  white-space: nowrap;
}

.frean-table--items thead th:first-child,
.frean-items-table thead th:first-child {
  border-radius: 10px 0 0 0;
}

.frean-table--items thead th:last-child,
.frean-items-table thead th:last-child {
  border-radius: 0 10px 0 0;
}

.frean-table--items tbody td,
.frean-items-table tbody td {
  vertical-align: middle;
  padding: var(--table-td-pad-items, 0.45rem 0.55rem) !important;
}

/* La última columna suele contener acciones: enlaces como botones compactos. */
.frean-main .table-shell tbody td:last-child a:not(.btn-table-icon),
.frean-main .table-responsive tbody td:last-child a:not(.btn-table-icon) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin: 0.12rem 0.15rem 0.12rem 0;
  padding: 0.3rem 0.65rem;
  border: 1px solid #cbe5f5;
  border-radius: 8px;
  background: #f3faff;
  color: #287eaf;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}

.frean-main .table-shell tbody td:last-child a:not(.btn-table-icon):hover,
.frean-main .table-responsive tbody td:last-child a:not(.btn-table-icon):hover {
  background: var(--frean-accent);
  border-color: var(--frean-accent);
  color: #fff;
  transform: translateY(-1px);
}

/* DataTables */
.frean-main .dataTables_wrapper .dataTables_length,
.frean-main .dataTables_wrapper .dataTables_filter {
  margin-bottom: 0.85rem;
  color: #687887;
  font-size: 0.82rem;
  font-weight: 650;
}

.frean-main .dataTables_wrapper .dataTables_filter input,
.frean-main .dataTables_wrapper .dataTables_length select {
  min-height: 36px;
  margin-left: 0.4rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid #d9e4ec;
  border-radius: 9px;
  background: #fff;
  color: var(--frean-text);
  outline: 0;
}

.frean-main .dataTables_wrapper .dataTables_filter input:focus,
.frean-main .dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--frean-accent);
  box-shadow: 0 0 0 3px rgba(70,173,237,.16);
}

.frean-main .dataTables_wrapper .dataTables_info {
  padding-top: 0.85rem;
  color: #82909c;
  font-size: 0.8rem;
}

.frean-main .dataTables_wrapper .dataTables_paginate {
  padding-top: 0.7rem;
}

.frean-main .dataTables_wrapper .dataTables_paginate .paginate_button {
  min-width: 34px;
  margin-left: 0.25rem;
  padding: 0.38rem 0.6rem !important;
  border: 1px solid #dce7ee !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: #577083 !important;
}

.frean-main .dataTables_wrapper .dataTables_paginate .paginate_button.current,
.frean-main .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  border-color: var(--frean-accent) !important;
  background: var(--frean-accent) !important;
  color: #fff !important;
}

/* Botones: lenguaje visual consistente en todo el contenido */
.frean-main .btn:not(.btn-table-icon) {
  min-height: 40px;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.87rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  box-shadow: none;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
}

.frean-main .btn:not(.btn-table-icon):hover { transform: translateY(-1px); }
.frean-main .btn:not(.btn-table-icon):focus { box-shadow: 0 0 0 3px rgba(70,173,237,.2) !important; }
.frean-main .btn.btn-sm:not(.btn-table-icon) {
  min-height: 32px;
  padding: 0.32rem 0.68rem;
  border-radius: 8px;
  font-size: 0.78rem;
}

.frean-main .btn-primary,
.frean-main .btn-app-blue {
  border-color: var(--frean-accent) !important;
  background: linear-gradient(135deg, var(--frean-accent), #359bd7) !important;
  color: #fff !important;
  box-shadow: 0 4px 11px rgba(70,173,237,.2);
}

.frean-main .btn-primary:hover,
.frean-main .btn-app-blue:hover {
  border-color: #2f91c9 !important;
  background: linear-gradient(135deg, #3ba5e4, #2f91c9) !important;
  box-shadow: 0 6px 15px rgba(70,173,237,.3);
}

.frean-main .btn-app-red {
  border-color: #d85b52 !important;
  background: linear-gradient(135deg, #e5736a, #d85b52) !important;
  color: #fff !important;
  box-shadow: 0 4px 11px rgba(216, 91, 82, 0.22);
}
.frean-main .btn-app-red:hover {
  border-color: #c34b42 !important;
  background: linear-gradient(135deg, #d85b52, #c34b42) !important;
  box-shadow: 0 6px 15px rgba(216, 91, 82, 0.32);
}

.frean-main .btn-app-orange {
  border-color: #e3a008 !important;
  background: linear-gradient(135deg, #f0b429, #e3a008) !important;
  color: #fff !important;
  box-shadow: 0 4px 11px rgba(227, 160, 8, 0.22);
}
.frean-main .btn-app-orange:hover {
  border-color: #c98b06 !important;
  background: linear-gradient(135deg, #e3a008, #c98b06) !important;
  box-shadow: 0 6px 15px rgba(227, 160, 8, 0.32);
}

.frean-main .btn-app-green {
  border-color: #2ecc71 !important;
  background: linear-gradient(135deg, #3ddc84, #2ecc71) !important;
  color: #fff !important;
  box-shadow: 0 4px 11px rgba(46, 204, 113, 0.22);
}
.frean-main .btn-app-green:hover {
  border-color: #27ae60 !important;
  background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
  box-shadow: 0 6px 15px rgba(46, 204, 113, 0.32);
}

.frean-main .btn-outline-primary {
  border-color: #9ed4f2;
  background: #f4fbff;
  color: #287eaf;
}
.frean-main .btn-outline-primary:hover { border-color: var(--frean-accent); background: var(--frean-accent); color: #fff; }
.frean-main .btn-outline-success {
  border-color: #b8dfc4;
  background: #f3faf5;
  color: #1f7a43;
}
.frean-main .btn-outline-success:hover { border-color: #218838; background: #218838; color: #fff; }
.frean-main .btn-outline-secondary { border-color: #d6e0e7; background: #fff; color: #637585; }
.frean-main .btn-outline-secondary:hover { border-color: #718596; background: #718596; color: #fff; }
.frean-main .btn-outline-danger { border-color: #f0b8b4; background: #fff8f7; color: #c34b42; }
.frean-main .btn-outline-danger:hover { border-color: #d85b52; background: #d85b52; color: #fff; }
.frean-main .btn-link { color: #308fbe; text-decoration: none; }
.frean-main .btn-link:hover { color: #226d94; background: #eef8fd; text-decoration: none; }

@media (max-width: 767.98px) {
  .table-shell { padding: 0.7rem; border-radius: 12px; }
  .frean-main .table { font-size: 0.84rem; }
  .frean-main .table thead th,
  .frean-main .table tbody td { padding: 0.62rem 0.65rem !important; }
  .frean-main .btn:not(.btn-table-icon) { min-height: 38px; padding: 0.45rem 0.78rem; }
  .frean-main .dataTables_wrapper .dataTables_filter,
  .frean-main .dataTables_wrapper .dataTables_length { float: none; text-align: left; }
  .frean-main .dataTables_wrapper .dataTables_filter input { width: calc(100% - 65px); }
}
.badge-cae,
.badge-anulado {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.1;
  padding: 0.28rem 0.58rem;
  border: 1px solid transparent;
  box-shadow: none;
}
.badge-cae {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}
.badge-anulado {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
.badge-pagada, .badge-parcial, .badge-pendiente {
  display: inline-block;
  padding: .25rem .55rem;
  border-radius: 8px;
  font-size: .76rem;
  font-weight: 750;
  white-space: nowrap;
}
.badge-pagada { background:#e8f6ef; color:#1e7a4a; }
.badge-parcial { background:#fff3d6; color:#916400; }
.badge-pendiente { background:#fde8e8; color:#b63b32; }

@media print {
  .ag-admin-topbar, .ag-admin-sidebar, .no-print, .page-header-app .text-muted { display:none !important; }
  .frean-main { margin:0 !important; }
  .frean-main .container-fluid { padding:0 !important; }
  .table-shell, .frean-card, .stat-tile { box-shadow:none !important; border:1px solid #bbb !important; }
  .iva-book { overflow:visible !important; page-break-inside:auto; }
  .iva-book tr { page-break-inside:avoid; }
  .iva-book .table { font-size:9px !important; }
  .iva-book .table th, .iva-book .table td { padding:4px !important; }
  a { color:#000 !important; text-decoration:none !important; }
  .frean-notice-stack, .ag-sidebar-flyout--cotiz { display:none !important; }
}

/* Cheques — vencimiento + estado */
.cheque-legend--header {
  margin: 0;
  justify-content: flex-end;
}

.page-header-actions .cheque-legend--header {
  max-width: min(28rem, 100%);
}

.page-header-actions .cheque-legend--header .cheque-pill {
  font-size: 0.68rem;
  padding: 0.12rem 0.4rem;
}

.cheque-pill,
.cheque-vence-badge,
.cheque-estado-badge {
  display: inline-block;
  border-radius: 8px;
  padding: 0.2rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.cheque-pill { border: 1px solid transparent; }

.cheque-vence-vencido,
tr.cheque-vence-vencido > td:first-child {
  /* tint row via badge; light row bg */
}
tr.cheque-vence-vencido { background: rgba(192, 57, 43, 0.08); }
tr.cheque-vence-pronto { background: rgba(211, 147, 36, 0.10); }
tr.cheque-vence-mes { background: rgba(52, 152, 219, 0.07); }
tr.cheque-vence-ok { background: transparent; }

.cheque-vence-vencido { background: #fde8e8; color: #c0392b; }
.cheque-vence-pronto { background: #fff3d6; color: #9a6b00; }
.cheque-vence-mes { background: #e4f3fd; color: #1f6fa5; }
.cheque-vence-ok { background: #e8f6ef; color: #1e7a4a; }
.cheque-vence-na { background: #eef1f4; color: #6b7280; }

.cheque-estado-cartera { background: #e4f3fd; color: #1f6fa5; }
.cheque-estado-depositado { background: #e8eaf6; color: #3f4c8c; }
.cheque-estado-cobrado { background: #e8f6ef; color: #1e7a4a; }
.cheque-estado-entregado { background: #f0f3f6; color: #4b5563; }
.cheque-estado-sin-fondo { background: #fde8e8; color: #c0392b; }
.cheque-estado-devuelto { background: #fcebdc; color: #b85c1a; }
.cheque-estado-otro { background: #eef1f4; color: #4b5563; }

.cheque-formato-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.cheque-formato-icheck {
  background: #eef2ff;
  color: #3730a3;
  border-color: #c7d2fe;
}
.cheque-formato-comun {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.cheque-action-modal.stock-action-modal .modal-dialog {
  max-width: min(46rem, calc(100vw - 1.5rem));
}

.cheque-modal-estado-panel {
  margin: 0 0 0.85rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid #bfdbfe;
  background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.cheque-modal-estado-panel.is-estado-cobrado {
  border-color: #86efac;
  background: linear-gradient(180deg, #ecfdf5 0%, #f8fffb 100%);
}
.cheque-modal-estado-panel.is-estado-sin-fondo {
  border-color: #fca5a5;
  background: linear-gradient(180deg, #fef2f2 0%, #fff8f8 100%);
}
.cheque-modal-estado-panel.is-estado-devuelto {
  border-color: #fdba74;
  background: linear-gradient(180deg, #fff7ed 0%, #fffaf5 100%);
}
.cheque-modal-estado-panel.is-estado-depositado {
  border-color: #c7d2fe;
  background: linear-gradient(180deg, #eef2ff 0%, #f8f9ff 100%);
}
.cheque-modal-estado-panel.is-estado-entregado {
  border-color: #cbd5e1;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.cheque-modal-estado-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.cheque-modal-estado-panel__eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1e3a5f;
}

.cheque-modal-estado-panel__hint {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.35;
}

.cheque-modal-estado-panel #ch-modal-estado-badge {
  flex: 0 0 auto;
  font-size: 0.84rem;
  padding: 0.28rem 0.7rem;
}

.cheque-modal-estado-panel__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  gap: 0.65rem 0.85rem;
  align-items: end;
}

.cheque-modal-estado-panel label,
.cheque-modal-field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.25rem;
}

.cheque-modal-field-label {
  margin-bottom: 0.25rem;
}

.cheque-formato-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  padding: 0.22rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #dbeafe;
}

.cheque-formato-option {
  margin: 0;
  cursor: pointer;
}

.cheque-formato-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cheque-formato-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  padding: 0.25rem 0.55rem;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #64748b;
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cheque-formato-option input:checked + span {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.cheque-formato-option input:focus-visible + span {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
}

.cheque-modal-propio-wrap {
  display: flex;
  align-items: center;
  min-height: 2.55rem;
  padding-bottom: 0.15rem;
}

.cheque-modal-propio-wrap .custom-control-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: #334155;
}

.cheque-modal-datos {
  padding-top: 0.15rem;
}

.cheque-modal-datos__title {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.cheque-action-modal .select2-container--bootstrap4.cheque-estado-select2 .select2-selection--single,
.cheque-action-modal #ch-modal-estado + .select2-container .select2-selection--single {
  border-color: #93c5fd !important;
  background: #fff !important;
  font-weight: 600;
}

@media (max-width: 767.98px) {
  .cheque-modal-estado-panel__grid {
    grid-template-columns: 1fr;
  }

  .cheque-modal-estado-panel__head {
    flex-direction: column;
    align-items: stretch;
  }

  .cheque-modal-estado-panel #ch-modal-estado-badge {
    align-self: flex-start;
  }
}

html[data-theme="dark"] .cheque-formato-icheck {
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
  border-color: rgba(165, 180, 252, 0.35);
}
html[data-theme="dark"] .cheque-formato-comun {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.25);
}
html[data-theme="dark"] .cheque-modal-estado-panel {
  border-color: rgba(147, 197, 253, 0.35);
  background: linear-gradient(180deg, rgba(30, 58, 95, 0.45) 0%, rgba(15, 23, 42, 0.35) 100%);
}
html[data-theme="dark"] .cheque-modal-estado-panel__eyebrow {
  color: #bfdbfe;
}
html[data-theme="dark"] .cheque-modal-estado-panel__hint,
html[data-theme="dark"] .cheque-modal-datos__title {
  color: #94a3b8;
}
html[data-theme="dark"] .cheque-formato-toggle {
  background: rgba(15, 23, 42, 0.35);
  border-color: rgba(148, 163, 184, 0.25);
}
html[data-theme="dark"] .cheque-formato-option input:checked + span {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

/* Reportes */
.report-chart-wrap {
  position: relative;
  height: 280px;
}
.report-chart-wrap.report-chart-sm {
  height: 220px;
}
.stat-tile .value.text-success { color: #1e7a4a !important; }
.stat-tile .value.text-danger { color: #c0392b !important; }

/* Login */
body.frean-login {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(70, 173, 237, 0.25), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(109, 137, 179, 0.2), transparent 45%),
    linear-gradient(160deg, #2c2f34 0%, #1a1c1f 55%, #2a3340 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.login-card {
  width: min(420px, 92vw);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.login-card .brand {
  font-size: 2rem;
  font-weight: var(--font-weight-bold, 700);
  color: #2c2f34;
  margin-bottom: 0.25rem;
}
.login-card .tagline {
  color: #64748b;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Monitor de stock (app/stock.php) */
body.admin-nav-rail main.app-list-page.frean-main:has(.stock-page-layout) {
  height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  max-height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.stock-page-layout) > .container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0 !important;
}

.stock-page-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  position: relative;
}

.stock-page-layout .stock-summary-row {
  flex: 0 0 auto;
  margin-bottom: 0;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
}

.stock-page-layout .stock-legend {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.stock-panels-stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.stock-panels-track {
  display: flex;
  width: 200%;
  height: 100%;
  transform: translateX(0);
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.stock-page-layout.is-kardex-view .stock-panels-track {
  transform: translateX(-50%);
}

.stock-panel {
  width: 50%;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-right: 0;
}

.stock-panel--kardex {
  padding-left: 0.15rem;
}

.stock-panel .table-shell--sticky,
.stock-panel .stock-kardex-inner {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

/* Riel vertical Stock ↔ Kardex (altura de la tabla) */
.stock-panel-rail-toggle {
  flex: 0 0 2.15rem;
  width: 2.15rem;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin: 0;
  padding: 0.75rem 0.2rem;
  border: 1px solid var(--frean-border, #e2e8f0);
  border-left: none;
  border-radius: 0 10px 10px 0;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  z-index: 2;
}

.stock-panel-rail-toggle:hover,
.stock-panel-rail-toggle:focus {
  outline: 0;
  background: #eff6ff;
  color: var(--frean-navy, #1e293b);
  border-color: #bfdbfe;
  box-shadow: inset 0 0 0 1px rgba(70, 173, 237, 0.12);
}

.stock-panel-rail-toggle.is-active {
  background: #718596;
  border-color: #718596;
  color: #fff;
}

.stock-panel-rail-toggle.is-active:hover,
.stock-panel-rail-toggle.is-active:focus {
  background: #5f7384;
  border-color: #5f7384;
  color: #fff;
  box-shadow: none;
}

.stock-panel-rail-toggle-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  line-height: 1;
}

.stock-kardex-toggle-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

/* KPIs en page header (look roomy compartido) */
.stock-header-kpis {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0.3rem;
  max-width: min(48rem, 100%);
}

.stock-header-kpi {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 4.4rem;
  margin: 0;
  padding: 0.22rem 0.45rem 0.22rem 0.5rem;
  border: 1px solid var(--frean-border, #e2e8f0);
  border-left-width: 3px;
  border-radius: 7px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  line-height: 1.15;
  overflow: hidden;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.stock-header-kpi:focus {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(70, 173, 237, 0.18);
}

.stock-header-kpi.is-active-filter {
  box-shadow: inset 0 0 0 1.5px var(--frean-accent, #46ADED);
  background: #f8fbff;
}

.stock-header-kpi .label {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  margin: 0;
}

.stock-header-kpi .value {
  display: block;
  width: 100%;
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--frean-navy, #1e293b);
  margin: 0.05rem 0 0;
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.15;
  font-variant-numeric: tabular-nums lining-nums;
}

.stock-header-kpi .stock-header-kpi-meta {
  font-size: 0.58rem;
  color: #94a3b8;
  margin-top: 0.05rem;
}

.stock-header-kpi--reservado { border-left-color: #e8590c; }
.stock-header-kpi--reservado .label { color: #e8590c; }
.stock-header-kpi--disponible { border-left-color: #218838; }
.stock-header-kpi--disponible .label { color: #218838; }
.stock-header-kpi--transito { border-left-color: #117a8b; }
.stock-header-kpi--transito .label { color: #117a8b; }
.stock-header-kpi--faltantes { border-left-color: #c92a2a; }
.stock-header-kpi--faltantes .label { color: #c92a2a; }
.stock-header-kpi--facturado { border-left-color: #7e22ce; }
.stock-header-kpi--facturado .label { color: #7e22ce; }
.stock-header-kpi--pend-fac { border-left-color: #854d0e; }
.stock-header-kpi--pend-fac .label { color: #854d0e; }

.stock-header-kpi--static {
  cursor: default;
}

.stock-header-kpi--static:focus {
  box-shadow: none;
}

.page-header-app:has(.stock-header-kpis) {
  align-items: center;
  gap: 0.5rem 0.85rem;
}

.page-header-app:has(.stock-header-kpis) h1 {
  font-size: 1.22rem;
  letter-spacing: -0.02em;
}

.page-header-app:has(.stock-header-kpis) .page-header-start {
  flex: 1 1 auto;
  min-width: 0;
}

.page-header-actions .stock-header-kpis {
  margin-left: 0;
  gap: 0.45rem;
  max-width: none;
  flex-wrap: nowrap;
  background: none;
  border: 0;
  padding: 0;
  box-shadow: none;
}

.page-header-actions .stock-header-kpi {
  min-width: 8.2rem;
  flex: 0 1 auto;
  max-width: 14rem;
  padding: 0.42rem 0.78rem 0.45rem 0.8rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  border-left-width: 3px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.045);
  background: #fff;
  line-height: 1.2;
}

.page-header-actions .stock-header-kpi .label {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  font-weight: 700;
  white-space: nowrap;
}

.page-header-actions .stock-header-kpi .value {
  font-size: 1.12rem;
  font-weight: var(--font-weight-bold, 700);
  letter-spacing: -0.02em;
  margin-top: 0.1rem;
}

.page-header-actions .stock-header-kpi .stock-header-kpi-meta {
  font-size: 0.64rem;
  margin-top: 0.06rem;
  white-space: nowrap;
}

@media (max-width: 991.98px) {
  .stock-header-kpis {
    max-width: 100%;
    justify-content: flex-start;
  }

  .stock-header-kpi {
    min-width: 3.9rem;
    padding: 0.18rem 0.35rem;
  }

  .stock-header-kpi .value {
    font-size: 0.84rem;
  }

  .page-header-actions .stock-header-kpi {
    min-width: 6.2rem;
    max-width: none;
    flex: 1 1 6.2rem;
    padding: 0.36rem 0.58rem;
  }

  .page-header-actions .stock-header-kpi .value {
    font-size: 1.08rem;
  }

  .page-header-actions .stock-header-kpis {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .stock-panel-rail-toggle {
    flex-basis: 1.85rem;
    width: 1.85rem;
  }

  .stock-kardex-toggle-label {
    font-size: 0.66rem;
  }
}

.stock-page-layout .stock-monitor-shell {
  flex: 1 1 auto;
  min-height: 0;
}

.stock-monitor-table .celda-codigo {
  width: 4.5rem;
  max-width: 4.5rem;
}

.stock-monitor-table .col-select {
  width: 2rem;
  max-width: 2rem;
  padding-left: 0.4rem;
  padding-right: 0.3rem;
  display: none;
}

.stock-page-layout.is-oc-selecting .stock-monitor-table .col-select,
.stock-page-layout.is-oc-selecting .dataTables_scrollHead .col-select {
  display: table-cell;
}

.stock-page-layout.is-oc-selecting .frean-table-actions .stock-oc-row-cart {
  display: none !important;
}

.dt-toolbar-left .stock-oc-toolbar {
  margin-left: 0.45rem;
}

.stock-oc-toolbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.stock-oc-toolbar .btn {
  white-space: nowrap;
}

.stock-oc-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0 0 0.4rem;
  padding: 0.38rem 0.65rem;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.stock-oc-banner.d-none {
  display: none !important;
}

.stock-oc-banner-label {
  font-size: 0.78rem;
  font-weight: 650;
  color: #334155;
}

.stock-oc-banner .table-filter-select {
  max-width: 10.5rem;
  min-width: 8rem;
}

#stock-oc-confirm-btn:disabled,
#stock-oc-confirm-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.stock-monitor-table .celda-producto {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Listado productos — columnas contenidas (misma lógica visual que stock) */
.productos-table .celda-codigo {
  width: 7.5rem;
  max-width: 7.5rem;
  white-space: nowrap;
}
.productos-table .celda-codigo code {
  font-size: 0.8rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: #f1f5f9;
  color: #334155;
}
.productos-table .celda-producto {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.productos-table .celda-rubro,
.productos-table .celda-subrubro {
  max-width: 9.5rem;
  white-space: nowrap;
}
.productos-table .celda-rubro .badge-mov-pill,
.productos-table .celda-subrubro .badge-mov-pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
}
.productos-table .celda-estado {
  width: 5.5rem;
  max-width: 5.5rem;
  white-space: nowrap;
}
.productos-table .celda-acciones {
  width: 5.2rem;
  max-width: 5.2rem;
  padding-left: 0.25rem;
  padding-right: 0.35rem;
}
.productos-table .celda-monto {
  width: 6.2rem;
}

tr.is-crosslink-hit > td {
  background: #eef7ff !important;
}
tr.is-crosslink-hit > td:first-child {
  box-shadow: inset 3px 0 0 #3b82f6;
}

.stock-monitor-table .celda-deposito {
  max-width: 6.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-monitor-table .celda-estado {
  width: 5.5rem;
  max-width: 5.5rem;
}

.stock-monitor-table .celda-acciones {
  width: 7.25rem;
  max-width: 7.25rem;
  padding-left: 0.25rem;
  padding-right: 0.35rem;
}

.stock-monitor-table .stock-qty-col {
  width: 3.6rem;
  max-width: 3.6rem;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
  font-size: 0.78rem;
}

.stock-monitor-table thead th {
  font-size: 0.72rem;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.stock-monitor-table tbody td {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  vertical-align: middle;
}

.frean-table-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.18rem;
}

.btn-table-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1.7rem !important;
  height: 1.7rem !important;
  min-width: 1.7rem !important;
  min-height: 1.7rem !important;
  max-width: 1.7rem !important;
  max-height: 1.7rem !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 1px solid #d9e4ec;
  border-radius: 6px !important;
  background: #fff;
  color: #64748b;
  font-size: 0.72rem !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  line-height: 1 !important;
  flex: 0 0 auto;
  box-sizing: border-box;
  vertical-align: middle;
  text-decoration: none !important;
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none !important;
  transform: none !important;
}

a.btn-table-icon,
button.btn-table-icon {
  text-decoration: none !important;
}

.btn-table-icon i {
  font-size: 0.72rem;
  width: 1em;
  height: 1em;
  line-height: 1;
  text-align: center;
}

.frean-main .frean-table-actions .btn.btn-table-icon,
.frean-main a.btn-table-icon,
.frean-main button.btn-table-icon {
  min-height: 1.7rem !important;
  min-width: 1.7rem !important;
  height: 1.7rem !important;
  width: 1.7rem !important;
  padding: 0 !important;
  line-height: 1 !important;
  transform: none !important;
}

.btn-table-icon:hover,
.btn-table-icon:focus {
  color: var(--frean-navy);
  border-color: #b8c9d9;
  background: #f8fafc;
  text-decoration: none;
  transform: none !important;
  box-shadow: none !important;
}

.btn-table-icon--primary {
  color: var(--frean-accent);
  border-color: rgba(70, 173, 237, 0.45);
}

.btn-table-icon--primary:hover,
.btn-table-icon--primary:focus {
  color: #fff;
  background: var(--frean-accent);
  border-color: var(--frean-accent);
}

.btn-table-icon--account {
  color: #0f766e;
  border-color: rgba(13, 148, 136, 0.4);
  background: #f0fdfa;
}

.btn-table-icon--account:hover,
.btn-table-icon--account:focus {
  color: #fff;
  background: #0d9488;
  border-color: #0d9488;
}

.btn-table-icon--edit {
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.4);
  background: #eff6ff;
}

.btn-table-icon--edit:hover,
.btn-table-icon--edit:focus {
  color: #fff;
  background: #2563eb;
  border-color: #2563eb;
}

.btn-table-icon--view {
  color: #475569;
  border-color: rgba(100, 116, 139, 0.4);
  background: #f8fafc;
}

.btn-table-icon--view:hover,
.btn-table-icon--view:focus {
  color: #fff;
  background: #475569;
  border-color: #475569;
}

.btn-table-icon--imputar {
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.4);
  background: #fffbeb;
}

.btn-table-icon--imputar:hover,
.btn-table-icon--imputar:focus {
  color: #fff;
  background: #d97706;
  border-color: #d97706;
}

.btn-table-icon--danger {
  color: #b42318;
  border-color: #f0b8b4;
  background: #fff8f7;
}
.btn-table-icon--danger:hover,
.btn-table-icon--danger:focus {
  color: #fff;
  border-color: #d85b52;
  background: #d85b52;
}

.table-select-check {
  width: 1rem;
  height: 1rem;
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
}
.frean-main .table th.col-select,
.frean-main .table td.col-select {
  width: 2.2rem;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  vertical-align: middle;
}
.table-shell.js-maestro-bulk .col-select {
  display: none;
}
.table-shell.js-maestro-bulk.is-bulk-selecting .col-select,
.table-shell.js-maestro-bulk.is-bulk-selecting .dataTables_scrollHead .col-select {
  display: table-cell;
}
.page-header-actions .btn {
  white-space: nowrap;
}
.page-header-actions:has(.btn-header-action) {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  justify-content: end;
  width: max-content;
  margin-left: auto;
}
.page-header-actions .btn-header-action {
  box-sizing: border-box;
  width: 100%;
  min-width: 9.85rem;
  height: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  padding: 0.32rem 0.68rem !important;
}
#clientes-bulk-delete.is-disabled,
#clientes-bulk-delete:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.stock-page-layout .stock-kardex-compact {
  flex: 0 0 auto;
  max-height: 9.5rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.stock-kardex-head {
  flex: 0 0 auto;
  padding: 0.45rem 0.85rem 0.25rem;
  border-bottom: 1px solid var(--frean-border);
}

.stock-kardex-head h6 {
  color: var(--frean-navy);
  font-weight: 700;
}

.stock-kardex-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 0.85rem 0.45rem;
}

.stock-monitor-filters-inline .stock-filter-group {
  flex-wrap: nowrap;
}

.table-toolbar-hint {
  white-space: nowrap;
  line-height: 1.5;
}

.table-toolbar-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a5f;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.2;
}

.table-toolbar-tag--hint {
  gap: 0.4rem;
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
  font-weight: 600;
}

.table-toolbar-tag--hint i {
  opacity: 0.85;
  font-size: 0.72rem;
}

.dt-unified-toolbar .table-toolbar-tag {
  margin: 0;
}

.stock-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stock-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.stock-legend .badge-mov-pill {
  font-size: 0.7rem;
}
.stock-monitor-section .table-shell {
  padding: 0;
  overflow: hidden;
}
.stock-monitor-section .table-responsive {
  padding: 0 1rem 1rem;
}
.stock-monitor-section .section-head {
  padding: 1rem 1rem 0.5rem;
}
.stock-monitor-section .section-head h5 {
  margin: 0 0 0.35rem;
  color: var(--frean-navy);
}
.stock-qty-col {
  text-align: right;
  white-space: nowrap;
}
.stock-row-comprometido {
  background: #fff8e6 !important;
}
.stock-row-comprometido td {
  border-bottom-color: #ffe082 !important;
}
.stock-kardex-section .section-head {
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--frean-border);
}
.stock-kardex-section .section-head h5 {
  margin: 0;
  color: var(--frean-navy);
}
.stock-monitor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.stock-filter-btn {
  position: relative;
}
.stock-filter-badge {
  display: inline-block;
  min-width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.35rem;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.15rem;
  text-align: center;
  vertical-align: middle;
}
.stock-filter-group .btn.active {
  font-weight: 700;
}
.stock-action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.stock-action-btns .btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
}
.stock-monitor-section .section-head-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.stat-tile-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-tile-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.15);
}
.stock-modal-readonly {
  background: #f8f9fa;
  font-weight: 600;
}

.maestro-form-actions .btn-app-blue,
.maestro-form-actions .btn-app-red,
.maestro-form-actions .btn-app-orange,
.maestro-form-actions .btn-app-green,
.frean-form-actions--footer .btn-app-blue,
.frean-form-actions--footer .btn-app-red,
.frean-form-actions--footer .btn-app-orange,
.frean-form-actions--footer .btn-app-green {
  box-sizing: border-box;
  height: 42px !important;
  min-height: 42px !important;
  min-width: 7.5rem;
  padding: 0 1.25rem !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1 !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  border-radius: 12px !important;
}

/* Modales de stock: fijos al viewport; scroll solo del body si hace falta */
.stock-action-modal.modal {
  overflow: hidden !important;
}

.stock-action-modal .modal-dialog {
  margin: 0.75rem auto;
  max-width: 28rem;
  max-height: calc(100dvh - 1.5rem);
}

.cliente-action-modal.stock-action-modal .modal-dialog {
  max-width: min(52rem, calc(100vw - 1.5rem));
  width: 100%;
}

.cliente-action-modal .cliente-modal-footer,
.stock-action-modal .cliente-modal-footer,
.stock-action-modal .modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.stock-action-modal .modal-footer .btn,
.cliente-action-modal .cliente-modal-footer .btn,
.stock-action-modal .cliente-modal-footer .btn {
  box-sizing: border-box;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  min-width: 7.5rem;
  padding: 0 1.25rem !important;
  margin: 0 !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  border-radius: 12px !important;
  border-width: 1px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  transform: none;
}

.stock-action-modal .modal-footer .btn-app-blue:hover,
.stock-action-modal .modal-footer .btn-app-red:hover,
.cliente-action-modal .cliente-modal-footer .btn-app-blue:hover,
.cliente-action-modal .cliente-modal-footer .btn-app-red:hover,
.stock-action-modal .cliente-modal-footer .btn-app-blue:hover,
.stock-action-modal .cliente-modal-footer .btn-app-red:hover {
  transform: translateY(-1px);
}

.stock-action-modal .select2-container--bootstrap4 .select2-selection--single {
  height: 42px !important;
  border-radius: 10px !important;
  border: 1px solid #e2e8f0 !important;
  background: #fff !important;
  display: flex !important;
  align-items: center;
}

.stock-action-modal .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  line-height: 1.25 !important;
  padding-left: 0.75rem !important;
  color: #1f2a37 !important;
  font-size: 0.9rem;
}

.stock-action-modal .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
  right: 0.35rem !important;
}

.stock-action-modal .select2-container--bootstrap4.select2-container--focus .select2-selection--single,
.stock-action-modal .select2-container--bootstrap4.select2-container--open .select2-selection--single {
  border-color: var(--frean-accent) !important;
  box-shadow: 0 0 0 3px rgba(70, 173, 237, 0.22);
}

.cliente-phone-row {
  display: grid;
  grid-template-columns: minmax(9.5rem, 1.15fr) minmax(4.5rem, 0.55fr) minmax(7rem, 1fr);
  gap: 0.45rem;
  align-items: stretch;
}

.cliente-phone-row .select2-container {
  width: 100% !important;
}

.cliente-country-option,
.cliente-country-selection {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1.2;
}

.cliente-country-flag {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.cliente-country-iso {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #1f2a37;
}

.cliente-country-dial {
  font-weight: 650;
  color: #475569;
}

.cliente-country-name {
  color: #82909c;
  font-size: 0.8rem;
}

.cliente-country-selection .cliente-country-name {
  display: none;
}

.select2-dropdown.cliente-country-dropdown .select2-results__option {
  padding: 0.45rem 0.7rem;
}

.dt-unified-toolbar .select2-container {
  margin: 0;
}

.dt-unified-toolbar .js-filter-select2 + .select2-container {
  width: 11.5rem !important;
  min-width: 11.5rem !important;
  max-width: 11.5rem !important;
}

.dt-unified-toolbar .table-inline-filters:has(.js-filter-select2:nth-child(4)) .js-filter-select2 + .select2-container {
  width: 9.4rem !important;
  min-width: 9.4rem !important;
  max-width: 9.4rem !important;
}

.dt-unified-toolbar .table-inline-filters:has(.js-filter-select2:nth-child(5)) .js-filter-select2 + .select2-container {
  width: 8.25rem !important;
  min-width: 8.25rem !important;
  max-width: 8.25rem !important;
}

.dt-unified-toolbar .select2-container--bootstrap4 .select2-selection--single {
  height: 36px !important;
  border-radius: 9px !important;
  border: 1px solid #d9e4ec !important;
  background: #fff !important;
  display: flex !important;
  align-items: center;
}

.dt-unified-toolbar .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  line-height: 1.2 !important;
  padding-left: 0.55rem !important;
  color: #475569 !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
}

.dt-unified-toolbar .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
  /* hereda centrado vertical global; solo asegura hueco a la derecha */
  right: 0.25rem !important;
}

.dt-unified-toolbar .select2-container--bootstrap4.select2-container--focus .select2-selection--single,
.dt-unified-toolbar .select2-container--bootstrap4.select2-container--open .select2-selection--single {
  border-color: var(--frean-accent) !important;
  box-shadow: 0 0 0 3px rgba(70, 173, 237, 0.16);
}

.select2-dropdown.table-filter-select2-dropdown {
  z-index: 2000 !important;
  min-width: 16.5rem !important;
  max-width: min(26rem, calc(100vw - 1.5rem)) !important;
}

/* El tema bootstrap4 fuerza width:100% en el host del dropdown (hijo de body).
   Al abrir, el contenedor nace en el select y se estira por todo el viewport → barra horizontal. */
body > .select2-container {
  width: auto !important;
  max-width: calc(100vw - 1rem) !important;
}

.select2-container--bootstrap4 .select2-results > .select2-results__options {
  overflow-x: hidden !important;
}

.select2-dropdown .select2-search--dropdown .select2-search__field {
  width: 100% !important;
  box-sizing: border-box !important;
}

@media (max-width: 575.98px) {
  .cliente-phone-row {
    grid-template-columns: 1fr;
  }
}

.cliente-action-modal.stock-action-modal .maestro-form-grid .premium-input,
.cliente-action-modal.stock-action-modal .maestro-form-grid .form-control {
  height: 42px !important;
  min-height: 42px !important;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.cliente-action-modal .select2-container--bootstrap4 .select2-selection--single {
  height: 42px !important;
  border-radius: 10px !important;
  border: 1px solid #e2e8f0 !important;
  background: #fff !important;
  display: flex !important;
  align-items: center;
}

.cliente-action-modal .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  line-height: 1.25 !important;
  padding-left: 0.75rem !important;
  color: #1f2a37 !important;
  font-size: 0.9rem;
}

.cliente-action-modal .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
  right: 0.35rem !important;
}

.cliente-action-modal .select2-container--bootstrap4.select2-container--focus .select2-selection--single,
.cliente-action-modal .select2-container--bootstrap4.select2-container--open .select2-selection--single {
  border-color: var(--frean-accent) !important;
  box-shadow: 0 0 0 3px rgba(70, 173, 237, 0.22);
}

.select2-dropdown.cliente-select2-dropdown {
  border: 1px solid #d9e4ec !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 28px rgba(31, 42, 55, 0.12);
  overflow: hidden;
  z-index: 2100 !important;
}

.select2-dropdown.cliente-select2-dropdown .select2-search--dropdown {
  padding: 0.55rem 0.6rem 0.35rem;
}

.select2-dropdown.cliente-select2-dropdown .select2-search__field {
  border-radius: 8px !important;
  border: 1px solid #e2e8f0 !important;
  padding: 0.4rem 0.55rem !important;
}

.select2-dropdown.cliente-select2-dropdown .select2-results__option {
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  line-height: 1.25;
  white-space: normal;
}

.select2-dropdown.cliente-select2-dropdown .select2-results__option--highlighted,
.select2-dropdown.cliente-select2-dropdown .select2-results__option--highlighted[aria-selected] {
  background: #eef7fc !important;
  color: #1f2a37 !important;
}

.select2-dropdown.cliente-select2-dropdown .select2-results__option[aria-selected=true] {
  background: #f4fbff;
  color: #1f2a37;
}

.cliente-select-option {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.cliente-select-option-title {
  font-weight: 650;
  color: #1f2a37;
}

.cliente-select-option-desc {
  font-size: 0.75rem;
  color: #82909c;
}

.stock-action-modal .modal-content {
  max-height: calc(100dvh - 1.5rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* El form envuelve body+footer: hay que mantener la cadena flex para que scrollee el body */
.stock-action-modal .modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.stock-action-modal .modal-header {
  flex: 0 0 auto;
  padding: 0.65rem 1rem;
}

.stock-action-modal .modal-title {
  font-size: 1rem;
  font-weight: 700;
}

.stock-action-modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem 1rem;
}

.stock-action-modal .modal-footer {
  flex: 0 0 auto;
  padding: 0.55rem 1rem;
}

.stock-action-modal .form-group label {
  font-size: 0.78rem;
  font-weight: 650;
  margin-bottom: 0.2rem;
}

.stock-action-modal .form-control,
.stock-action-modal .premium-input {
  min-height: 34px;
  font-size: 0.88rem;
}

.stock-modal-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.6rem;
  background: #f8fafc;
  border: 1px solid #edf1f5;
  border-radius: 8px;
}

.stock-modal-meta-item {
  min-width: 0;
}

.stock-modal-meta-item--wide {
  grid-column: 1 / -1;
}

.stock-modal-meta-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #94a3b8;
  margin-bottom: 0.08rem;
}

.stock-modal-meta-value {
  display: block;
  font-size: 0.84rem;
  font-weight: 650;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-modal-note {
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.3;
}

body.modal-open:has(.stock-action-modal.show) {
  overflow: hidden !important;
  padding-right: 0 !important;
}
.operacion-progress {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 5.5rem;
}
.operacion-progress-track {
  flex: 1;
  height: 0.35rem;
  background: #e9ecef;
  border-radius: 999px;
  overflow: hidden;
}
.operacion-progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.2s ease;
}
.operacion-progress-bar--ok { background: #28a745; }
.operacion-progress-bar--partial { background: #ffc107; }
.operacion-progress-bar--none { background: #adb5bd; }
.operacion-progress-pct {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  min-width: 2rem;
  text-align: right;
}
.operacion-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.operacion-stats-row .stat-tile .value {
  font-size: 1.2rem;
}

/* ——— Detalle operación (OC / pedido) ——— */
body.admin-nav-rail main.app-list-page.frean-main:has(.operacion-ver-layout) {
  height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  max-height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.operacion-ver-layout) > .container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0.65rem !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.operacion-ver-layout) .page-header-app {
  flex: 0 0 auto;
}

.operacion-ver-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0.45rem;
}

.operacion-ver-summary {
  flex: 0 0 auto;
  padding: 0.4rem 0.7rem !important;
  margin-bottom: 0 !important;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.85rem;
}

.operacion-ver-summary-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.85rem;
  min-width: 0;
  flex: 1 1 auto;
}

.operacion-ver-oc-num {
  font-weight: 800;
  font-size: 1.05rem;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.operacion-ver-meta {
  font-size: 0.8rem;
  color: #64748b;
  white-space: nowrap;
}

.operacion-ver-summary-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.operacion-ver-summary-proveedor,
.operacion-ver-summary-cliente {
  font-size: 0.84rem;
  min-width: 0;
}

.operacion-ver-obs {
  display: inline-block;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.operacion-ver-summary-total {
  flex: 0 0 auto;
  text-align: right;
  white-space: nowrap;
}

.operacion-ver-total-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #94a3b8;
}

.operacion-ver-total-value {
  font-size: 1.05rem;
  color: #334155;
}

.operacion-lines-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
}

.operacion-lines-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.operacion-lines-shell > .frean-form-actions--footer {
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0.55rem 1rem 0.65rem;
}

.operacion-lines-shell > .frean-form-actions--footer .collapse,
.operacion-lines-shell > .frean-form-actions--footer .op-ver-block-form {
  width: 100%;
}

.operacion-ver-panel {
  flex: 0 0 auto;
  padding: 0.75rem 1rem !important;
  margin-bottom: 0 !important;
}

.operacion-ver-sectors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem 0.65rem;
  align-items: stretch;
}

.operacion-ver-sectors--pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.operacion-ver-sectors--trio {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.operacion-ver-sectors--one {
  grid-template-columns: 1fr;
}

/* Factura: Acciones/IVA compactas; cobros ocupan el resto (sin scroll horizontal) */
.operacion-ver-sectors--comprobante {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.65rem 0.75rem;
}

.operacion-ver-sectors--comprobante .operacion-ver-sector--remitos {
  flex: 0 1 15.5rem;
}

.operacion-ver-sectors--comprobante .operacion-ver-sector--facturas {
  flex: 0 1 11.5rem;
}

.operacion-ver-sectors--comprobante .operacion-ver-sector--cobros {
  flex: 1 1 22rem;
  min-width: 0;
}

.operacion-ver-sector {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  min-height: 0;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: #f8fafb;
  border: 1px solid #edf1f5;
}

.operacion-docs-chips {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.25rem;
  min-height: 1.55rem;
  flex: 1 1 auto;
}

.operacion-ver-otros-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid #edf1f5;
}

.operacion-ver-sector--remitos {
  border-left: 3px solid #28a745;
}

.operacion-ver-sector--facturas {
  border-left: 3px solid var(--frean-accent, #46ADED);
}

.operacion-ver-sector--otros {
  background: #fafbfc;
  border-left: 3px solid #94a3b8;
}

.operacion-ver-sector-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin: 0;
}

.operacion-ver-sector-title--remito {
  color: #1f7a43;
}

.operacion-ver-sector-title--factura {
  color: #1a7aad;
}

.operacion-ver-sector-title--acciones {
  color: #64748b;
}

.operacion-ver-sector-btn {
  align-self: flex-start;
  margin-top: 0.1rem;
}

.operacion-ver-otros-actions {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.4rem;
  align-items: flex-start;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.operacion-ver-otros-actions .operacion-ver-sector-btn {
  align-self: flex-start;
  width: auto;
  max-width: 100%;
  white-space: normal;
  height: auto !important;
  min-height: 42px !important;
  text-align: left;
}

.operacion-ver-cancel-form {
  display: flex;
  margin: 0;
  width: auto;
  max-width: 100%;
}

.operacion-ver-cancel-form .btn {
  width: auto;
  max-width: 100%;
}

.operacion-doc-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 650;
  text-decoration: none !important;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.operacion-doc-chip--remito {
  background: #edf7f0;
  border-color: #cce8d6;
  color: #1f7a43;
}

.operacion-doc-chip--remito:hover {
  background: #dff0e6;
  color: #166534;
}

.operacion-doc-chip--factura {
  background: #eaf5fc;
  border-color: #c5e4f7;
  color: #1a7aad;
}

.operacion-doc-chip--factura:hover {
  background: #d9eef9;
  color: #155f82;
}

.operacion-stats-row--footer {
  flex: 0 0 auto;
  margin-bottom: 0;
  gap: 0.45rem;
  padding-bottom: 0.5rem;
}

.operacion-stats-row--footer .stat-tile {
  padding: 0.45rem 0.6rem;
}

.operacion-stats-row--footer .stat-tile .value {
  font-size: 1rem;
}

.operacion-stats-row--footer .stat-tile .label {
  font-size: 0.68rem;
}

@media (max-width: 991.98px) {
  .operacion-ver-sectors,
  .operacion-ver-sectors--pair,
  .operacion-ver-sectors--trio {
    grid-template-columns: 1fr;
  }

  .operacion-ver-sectors--comprobante .operacion-ver-sector--remitos,
  .operacion-ver-sectors--comprobante .operacion-ver-sector--facturas,
  .operacion-ver-sectors--comprobante .operacion-ver-sector--cobros {
    flex: 1 1 100%;
  }
}

@media (max-width: 767.98px) {
  .operacion-ver-summary-total {
    width: 100%;
    text-align: left;
  }
}

/* OP ver — tabs y árbol en cascada */
.operacion-ver-tabs {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
  margin-bottom: 0 !important;
}

.nav-tabs-compact {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--frean-border);
  padding: 0.35rem 0.65rem 0;
  margin-bottom: 0;
}

.nav-tabs-compact .nav-link {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}

.nav-tabs-compact .nav-link.active {
  color: var(--frean-navy);
  background: transparent;
  border-bottom-color: var(--frean-accent);
}

.op-ver-tab-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.op-ver-tab-content .tab-pane {
  flex: 1 1 auto;
  min-height: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.op-ver-tab-content .tab-pane.active.show {
  display: flex;
}

.mrp-cascade-scroll,
.op-ver-materiales-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 0.5rem 0.5rem;
}

.op-ver-tab-hint {
  font-size: 0.75rem !important;
  line-height: 1.3;
  margin-bottom: 0.35rem !important;
  padding-top: 0.35rem !important;
}

.op-ver-mats-hint {
  flex: 0 0 auto;
  font-size: 0.75rem;
  line-height: 1.35;
  padding: 0.4rem 0.65rem 0.25rem;
}

.op-mat-row-short > td {
  background-color: #fff8eb !important;
  border-bottom-color: #f3e2c4 !important;
}

.op-mat-row-short:hover > td {
  background-color: #fef3c7 !important;
}

.op-mat-row-short > td:first-child {
  box-shadow: inset 3px 0 0 #f3d38a;
}

.op-mat-row-short:hover > td:first-child {
  box-shadow: inset 3px 0 0 #e8b84a;
}

.op-mat-row-short td code {
  background-color: transparent !important;
}

.op-ver-bloqueo-alert {
  border-left: 3px solid #e67e22;
}

.op-ver-block-form {
  max-width: 42rem;
}

.op-ver-block-form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.op-ver-block-form-row .form-control {
  flex: 1 1 16rem;
  min-width: 12rem;
  height: 42px;
  min-height: 42px;
  border-radius: 12px;
  padding: 0.45rem 0.85rem;
}

.operacion-ver-otros-row--actions .btn,
.table-bottom-actions .btn,
.operacion-ver-otros-actions .btn,
.operacion-ver-sector-btn,
.frean-form-actions--footer .btn,
.op-ver-block-form .btn {
  box-sizing: border-box;
  height: 42px !important;
  min-height: 42px !important;
  min-width: 7.5rem;
  padding: 0 1.15rem !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1 !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  border-radius: 12px !important;
}

.table-bottom-actions {
  flex: 0 0 auto;
}

.bom-ver-main-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
}

.bom-ver-main-shell .bom-view-stage {
  flex: 1 1 auto;
  min-height: 0;
}

.bom-ver-main-shell .bom-view-panel .table-shell {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

.bom-ver-layout > .table-bottom-actions {
  margin-top: 0;
}

.table-bottom-actions .bom-create-op-form,
.operacion-ver-otros-row--actions .bom-create-op-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  margin: 0;
  width: auto;
}

.mrp-cascade-tree,
.mrp-cascade-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mrp-cascade-children {
  margin-left: 1.15rem;
  padding-left: 0.65rem;
  border-left: 2px solid #e2e8f0;
}

.mrp-cascade-item {
  margin: 0.35rem 0;
}

.mrp-cascade-row-start {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
}

.mrp-cascade-expand-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: 1px solid #d9e4ec;
  border-radius: 6px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.mrp-cascade-expand-btn:hover,
.mrp-cascade-expand-btn:focus {
  background: #f8fafc;
  color: var(--frean-navy);
  outline: 0;
}

.mrp-cascade-expand-btn[aria-expanded="true"] .mrp-cascade-expand-icon {
  transform: rotate(90deg);
}

.mrp-cascade-expand-icon {
  font-size: 0.65rem;
  transition: transform 0.15s ease;
}

.mrp-cascade-expand-spacer {
  flex: 0 0 auto;
  width: 1.65rem;
  height: 1.65rem;
}

.mrp-cascade-row--producto-final {
  border-color: #b8e0c8;
  background: linear-gradient(180deg, #f6fffa 0%, #fff 100%);
}

.mrp-cascade-section-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.65rem;
}

.mrp-cascade-hint {
  margin-top: 0.25rem;
  line-height: 1.3;
}

.mrp-cascade-children.collapse:not(.show) {
  display: none;
}

.mrp-cascade-children.collapsing {
  overflow: hidden;
  transition: height 0.2s ease;
}

.mrp-cascade-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #edf1f5;
  border-radius: 9px;
  background: #fff;
}

.mrp-cascade-row--alert {
  border-color: #ffe082;
  background: #fffdf5;
}

.mrp-cascade-row--partial {
  border-color: #b8daff;
  background: #f8fbff;
}

.mrp-cascade-main {
  flex: 1 1 auto;
  min-width: 0;
}

.mrp-cascade-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.35rem;
}

.mrp-cascade-code {
  font-size: 0.78rem;
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.mrp-cascade-name {
  font-weight: 650;
  color: #334155;
  font-size: 0.84rem;
}

.mrp-cascade-qtys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
}

.mrp-cascade-qty {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
}

.mrp-cascade-qty-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #94a3b8;
}

.mrp-cascade-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.mrp-cascade-fab-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.mrp-cascade-fab-qty {
  width: 5.5rem;
  max-width: 5.5rem;
}

/* ——— Layout compacto (ERP admin rail) ——— */
body.admin-nav-rail main.app-list-page.frean-main {
  padding-top: 0 !important;
  padding-bottom: 0.75rem;
  min-height: 0 !important;
}

/* Listado con tabla sticky: viewport fijo, scroll solo en tbody */
body.admin-nav-rail main.app-list-page.frean-main:has(.table-shell--sticky):not(:has(.reportes-layout)) {
  height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  max-height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.table-shell--sticky):not(:has(.reportes-layout)) > .container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0.75rem !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.table-shell--sticky):not(:has(.reportes-layout)) .page-header-app {
  flex: 0 0 auto;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.table-shell--sticky):not(:has(.reportes-layout)) .list-page-actions {
  flex: 0 0 auto;
}

body.admin-nav-rail main.app-list-page.frean-main .page-header-app {
  margin-top: 0 !important;
  margin-bottom: 0.35rem !important;
  gap: 0.25rem 0.75rem;
}

.page-header-app--split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
}

.page-header-start {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.2rem 0.4rem;
  min-width: 0;
}

.page-header-back {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  text-decoration: none !important;
  line-height: 1.2;
  transition: color 0.15s ease;
}

.page-header-back:hover,
.page-header-back:focus {
  color: var(--frean-accent, #46ADED);
  text-decoration: none;
}

.page-header-title-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem 0.4rem;
}

.page-header-back-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  margin: 0;
  border-radius: 8px;
  color: #64748b;
  text-decoration: none !important;
  flex-shrink: 0;
  font-size: 0.85rem;
  line-height: 1;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.page-header-back-icon:hover,
.page-header-back-icon:focus {
  color: var(--frean-accent, #46ADED);
  background: #eaf5fc;
  outline: none;
  text-decoration: none;
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-left: auto;
}

.page-header-actions .btn-sm {
  min-height: 34px;
  padding: 0.28rem 0.75rem;
}

/* Misma caja que «Nueva operación de compra» (btn-app-blue) para Ver stock / tránsito y pares del encabezado */
.page-header-actions > .btn.btn-sm:not(.btn-header-action) {
  box-sizing: border-box;
  min-height: 38px !important;
  padding: 8px 16px !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  border-radius: 10px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.btn-page-info {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--frean-accent, #46ADED);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.btn-page-info:hover,
.btn-page-info:focus {
  color: var(--frean-accent-dark, #359cd9);
  background: #eaf5fc;
  outline: none;
  transform: scale(1.05);
}

.page-help-wrap {
  position: relative;
}

.page-help-modal .modal-header {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid #edf1f5;
}

.page-help-modal .modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #334155;
}

.page-help-modal-body {
  font-size: 0.86rem;
  line-height: 1.5;
  color: #475569;
  text-align: left;
}

.page-help-modal-body .page-help-lead {
  color: #334155;
}

.page-help-modal-body h6 {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin: 0.65rem 0 0.25rem;
}

.page-help-modal-body h6:first-of-type {
  margin-top: 0;
}

.page-help-modal-body ul,
.page-help-modal-body ol {
  margin: 0;
  padding-left: 1.15rem;
}

.page-help-modal-body .page-help-steps {
  padding-left: 1.25rem;
}

.page-help-modal-body li + li {
  margin-top: 0.18rem;
}

@media (max-width: 575.98px) {
  .page-header-app--split {
    align-items: flex-start;
  }

  .page-header-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .page-header-actions .btn-sm {
    flex: 1 1 auto;
  }
}

body.admin-nav-rail main.app-list-page.frean-main .page-header-app--split h1 {
  font-size: 1.48rem;
  line-height: 1.12;
  margin-bottom: 0 !important;
}

body.admin-nav-rail main.app-list-page.frean-main .page-header-app h1 {
  font-size: 1.3rem;
  line-height: 1.1;
  margin-bottom: 0 !important;
}

body.admin-nav-rail main.app-list-page.frean-main .page-header-app p {
  font-size: 0.8rem;
  line-height: 1.2;
  margin-bottom: 0 !important;
}

.list-page-actions .btn-sm {
  min-height: 34px;
  padding: 0.28rem 0.75rem;
}

/* ——— Píldoras suaves (tags / badges) ——— */
.badge-mov-pill {
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.1;
  padding: 0.28rem 0.58rem;
  border: 1px solid transparent;
  box-shadow: none;
}

.frean-main .badge:not(.badge-mov-pill) {
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.1;
  padding: 0.28rem 0.58rem;
  border: 1px solid transparent;
}

.frean-main .badge-success { background: #edf7f0; color: #1f7a43; border-color: #cce8d6; }
.frean-main .badge-warning { background: #fff8e8; color: #9a6b00; border-color: #ffe8a8; }
.frean-main .badge-info { background: #eaf5fc; color: #1a7aad; border-color: #c5e4f7; }
.frean-main .badge-secondary,
.frean-main .badge-light { background: #f1f4f7; color: #5c6b7a; border-color: #e2e8ef; }
.frean-main .badge-dark { background: #eceff3; color: #4a5568; border-color: #d5dbe3; }

/* Variantes pill — fondos más claros */
.badge-mov-pill.badge-mov-estado-activo { background: #f0faf3; border-color: #ccebd6; color: #1f7a43; }
.badge-mov-pill.badge-mov-estado-pendiente { background: #fffbeb; border-color: #fde68a; color: #92600a; }
.badge-mov-pill.badge-mov-estado-anulado { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.badge-mov-pill.badge-mov-estado-compensa { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.badge-mov-pill.badge-mov-tipo-ingreso { background: #eff9fc; border-color: #bae6fd; color: #0e7490; }
.badge-mov-pill.badge-mov-tipo-compra { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.badge-mov-pill.badge-mov-tipo-deuda { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.badge-mov-pill.badge-mov-tipo-apertura,
.badge-mov-pill.badge-mov-tipo-otro { background: #f4f6f8; border-color: #e2e8ef; color: #5c6b7a; }
.badge-mov-pill.badge-mov-tipo-cierre { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }

/* ——— Celdas sin salto de línea ——— */
.celda-fecha,
.celda-monto,
.celda-usuario,
.mov-monto-total {
  white-space: nowrap;
}

.celda-fecha {
  font-variant-numeric: tabular-nums;
  min-width: 5.5rem;
}

.celda-monto {
  font-variant-numeric: tabular-nums lining-nums;
  min-width: 5.5rem;
  white-space: nowrap !important;
}

.celda-usuario {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ——— Filtros inline sobre tabla (DataTables) ——— */
.dt-toolbar-row {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  width: 100%;
  float: none !important;
  text-align: left !important;
}

.dt-toolbar-row label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 !important;
  white-space: nowrap;
}

.table-inline-filters,
.table-inline-filters-mounted {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-right: auto;
  flex: 1 1 auto;
  min-width: 0;
}

.table-filter-select {
  height: 36px;
  max-width: 11.5rem;
  min-width: 7.5rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid #d9e4ec;
  border-radius: 9px;
  background: #fff;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  outline: 0;
}

.table-filter-select:focus {
  border-color: var(--frean-accent);
  box-shadow: 0 0 0 3px rgba(70, 173, 237, 0.16);
}

.table-filter-date {
  height: 36px;
  max-width: 9.5rem;
  min-width: 7.5rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid #d9e4ec;
  border-radius: 9px;
  background: #fff;
  color: #475569;
  font-size: 0.78rem;
}

.table-filter-date:focus {
  border-color: var(--frean-accent);
  box-shadow: 0 0 0 3px rgba(70, 173, 237, 0.16);
}

.table-filter-date-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 36px;
  min-width: 10.25rem;
  max-width: 11.5rem;
  padding: 0 0.45rem 0 0.55rem;
  border: 1px solid #d9e4ec;
  border-radius: 9px;
  background: #fff;
  box-sizing: border-box;
  flex: 0 0 auto;
  position: relative;
  vertical-align: middle;
}

.table-filter-date-wrap:focus-within {
  border-color: var(--frean-accent);
  box-shadow: 0 0 0 3px rgba(70, 173, 237, 0.16);
}

.table-filter-date-prefix {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #64748b;
  white-space: nowrap;
  line-height: 1;
  user-select: none;
}

.table-filter-date-wrap .table-filter-date,
.table-filter-date-wrap .table-filter-date-alt,
.table-filter-date-wrap input.frean-date-alt {
  flex: 1 1 auto;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 0.15rem 0 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0.78rem !important;
  font-weight: 600;
  color: #334155;
  outline: 0 !important;
}

.table-filter-date-wrap .table-filter-date-alt::placeholder,
.table-filter-date-wrap input.frean-date-alt::placeholder {
  color: #94a3b8;
  font-weight: 500;
}

.dt-unified-toolbar .table-filter-date-wrap {
  height: 36px;
}

.table-filter-clear {
  min-height: 32px !important;
  padding: 0.22rem 0.65rem !important;
  font-size: 0.75rem !important;
  white-space: nowrap;
}

.table-inline-filters--bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding-bottom: 0.45rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid #edf1f5;
  width: 100%;
}

/* Barra unificada: Mostrar (izq) | filtros + limpiar (centro) | buscar (der) */
.dt-unified-toolbar-row {
  margin-left: 0 !important;
  margin-right: 0 !important;
  margin-bottom: 0.35rem !important;
  width: 100%;
}

.dt-unified-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem 0.75rem;
  width: 100%;
}

.dt-toolbar-left {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dt-toolbar-center {
  justify-self: center;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem 0.35rem;
  min-width: 0;
}

.dt-toolbar-right {
  justify-self: end;
  display: flex;
  align-items: center;
}

.dt-unified-toolbar .dataTables_length,
.dt-unified-toolbar .dataTables_filter {
  float: none !important;
  margin: 0 !important;
  text-align: left !important;
}

.dt-unified-toolbar .dataTables_length label,
.dt-unified-toolbar .dataTables_filter label {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 650;
  color: #64748b;
}

.btn-filter-clear {
  flex-shrink: 0;
  min-height: 36px !important;
  padding: 0.28rem 0.75rem !important;
  border-radius: 9px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  border: 1px solid #f1c0c0 !important;
  background: #fdeaea !important;
  color: #d99898 !important;
  box-shadow: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-filter-clear.is-disabled {
  opacity: 1;
  pointer-events: none;
  cursor: default;
}

.btn-filter-clear:not(.is-disabled) {
  border-color: #dc3545 !important;
  background: linear-gradient(180deg, #ef5350 0%, #dc3545 100%) !important;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.28);
}

.btn-filter-clear:hover:not(.is-disabled),
.btn-filter-clear:focus:not(.is-disabled) {
  background: linear-gradient(180deg, #dc3545 0%, #c82333 100%) !important;
  border-color: #c82333 !important;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(200, 35, 51, 0.32);
}

.dt-unified-toolbar .table-inline-filters {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  width: auto !important;
  max-width: none;
  flex: 0 0 auto;
  min-width: 0;
  margin: 0;
}

.dt-unified-toolbar .table-inline-filters .table-filter-select,
.dt-unified-toolbar .table-inline-filters .js-filter-select2 {
  width: 11.5rem !important;
  max-width: 11.5rem !important;
  flex: 0 0 11.5rem;
}

.dt-unified-toolbar .table-inline-filters .select2-container {
  display: inline-block !important;
  width: 11.5rem !important;
  max-width: 11.5rem !important;
  min-width: 11.5rem !important;
  flex: 0 0 11.5rem;
  margin: 0 !important;
  vertical-align: middle;
}

.dt-unified-toolbar .table-inline-filters:has(.js-filter-select2:nth-child(4)) .select2-container,
.dt-unified-toolbar .table-inline-filters:has(.js-filter-select2:nth-child(4)) .js-filter-select2 {
  width: 9.4rem !important;
  min-width: 9.4rem !important;
  max-width: 9.4rem !important;
  flex-basis: 9.4rem;
}

.dt-unified-toolbar .table-inline-filters:has(.js-filter-select2:nth-child(5)) .select2-container,
.dt-unified-toolbar .table-inline-filters:has(.js-filter-select2:nth-child(5)) .js-filter-select2 {
  width: 8.25rem !important;
  min-width: 8.25rem !important;
  max-width: 8.25rem !important;
  flex-basis: 8.25rem;
}

.dt-unified-toolbar .table-filter-clear,
.dt-unified-toolbar .btn-filter-clear {
  flex: 0 0 auto;
  align-self: center;
}

.table-filter-clear.is-disabled {
  pointer-events: none;
  cursor: default;
}

.celda-numero {
  font-weight: var(--font-weight-medium, 500);
  color: #34495e;
  font-variant-numeric: tabular-nums;
}

.frean-main .table tbody td code,
.frean-main .table tbody td.celda-numero {
  color: #34495e;
  background: transparent;
  padding: 0;
  font-size: inherit;
}

.operacion-celda-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  min-width: 7.5rem;
}

.operacion-celda-doc {
  line-height: 1.2;
}

.operacion-doc-empty {
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
}

.operacion-doc-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.22rem 0.55rem;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.1;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.operacion-doc-link--factura {
  border: 1px solid #9ed4f2;
  background: #f0f9ff;
  color: #1a7aad;
}

.operacion-doc-link--factura:hover {
  background: #46aded;
  border-color: #46aded;
  color: #fff;
  transform: translateY(-1px);
}

.operacion-doc-link--remito {
  border: 1px solid #a7e3bc;
  background: #f0faf4;
  color: #1f7a43;
}

.operacion-doc-link--remito:hover {
  background: #2ecc71;
  border-color: #2ecc71;
  color: #fff;
  transform: translateY(-1px);
}

.operacion-col-docs {
  vertical-align: middle !important;
}

.frean-main .dataTables_wrapper > .row:first-child {
  align-items: center;
  margin-bottom: 0.35rem;
}

.frean-main .dataTables_wrapper .dataTables_length {
  margin-bottom: 0;
}

.frean-main .dataTables_wrapper .dataTables_filter {
  margin-bottom: 0;
}

@media (max-width: 767.98px) {
  .dt-unified-toolbar {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }
  .dt-toolbar-left,
  .dt-toolbar-center,
  .dt-toolbar-right {
    justify-self: stretch;
    width: 100%;
  }
  .dt-toolbar-center {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .dt-unified-toolbar .table-inline-filters {
    flex-wrap: wrap !important;
  }
  .dt-toolbar-right .dataTables_filter {
    width: 100%;
  }
  .dt-toolbar-right .dataTables_filter label {
    width: 100%;
  }
  .dt-toolbar-right .dataTables_filter input {
    flex: 1 1 auto;
    width: 100% !important;
  }
  .table-inline-filters,
  .table-inline-filters-mounted {
    width: 100%;
    margin-right: 0;
    margin-bottom: 0;
    justify-content: flex-start !important;
  }
  .table-filter-select {
    flex: 1 1 calc(50% - 0.35rem);
    max-width: none;
  }
  .dt-toolbar-row {
    flex-direction: column;
    align-items: stretch !important;
  }
}

/* ——— Tabla con cabecera fija + scroll en cuerpo ——— */
.table-shell--sticky {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.65rem 0.75rem 0.45rem;
  overflow: hidden;
  margin-bottom: 0;
}

/* Evita flash: toolbar DT por defecto → layout unificado (hasta initComplete) */
.table-shell--sticky.frean-dt-pending > table {
  display: none;
}

.table-shell--sticky.frean-dt-pending .dataTables_wrapper {
  opacity: 0;
  pointer-events: none;
}

.table-shell--sticky.frean-dt-ready .dataTables_wrapper {
  opacity: 1;
  transition: opacity 0.12s ease;
}

.table-shell--sticky.frean-dt-pending::before {
  content: '';
  display: block;
  flex: 1 1 auto;
  min-height: 6rem;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.table-shell--sticky .dataTables_wrapper {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.table-shell--sticky .dataTables_wrapper > .row:first-child,
.table-shell--sticky .dt-unified-toolbar-row {
  flex: 0 0 auto;
}

.table-shell--sticky .dataTables_scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-shell--sticky .dataTables_scrollHead {
  flex: 0 0 auto;
}

.table-shell--sticky .dataTables_scrollHead thead th {
  background: linear-gradient(180deg, #f5f9fc 0%, #edf4f8 100%);
}

/* El thead clonado en el body no debe verse: el padding !important de
   .frean-main .table thead th le gana al colapso de app-listado.css. */
.frean-main .dataTables_scrollBody thead,
.frean-main .dataTables_scrollBody thead tr {
  visibility: collapse;
  height: 0 !important;
  line-height: 0 !important;
  border: 0 !important;
}

.frean-main .dataTables_scrollBody table.table thead th,
.frean-main .dataTables_scrollBody table.dataTable thead th,
.frean-main .dataTables_scrollBody thead td {
  padding: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  border: 0 !important;
  line-height: 0 !important;
  font-size: 0 !important;
  overflow: hidden !important;
  background: transparent !important;
  box-shadow: none !important;
  color: transparent !important;
}

.frean-main .dataTables_scrollBody thead th::before,
.frean-main .dataTables_scrollBody thead th::after {
  display: none !important;
  content: none !important;
}

.table-shell--sticky .dataTables_scrollBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: auto !important;
}

.table-shell--sticky .dt-footer-row,
.table-shell--sticky .dataTables_wrapper > .row:last-child,
.reportes-layout .reportes-table-shell .dataTables_wrapper > .row:last-child {
  flex: 0 0 auto;
  display: flex !important;
  flex-wrap: nowrap !important;
  flex-direction: row !important;
  margin-top: 0.12rem !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-top: 0.2rem !important;
  padding-bottom: 0.25rem !important;
  border-top: 1px solid #edf1f5;
  background: #fff;
  align-items: center !important;
  min-height: 0 !important;
}

.table-shell--sticky .dt-footer-row .dataTables_info {
  flex: 1 1 0;
  justify-content: flex-start;
  min-width: 0;
}

.table-shell--sticky .dt-footer-row .dt-footer-center {
  flex: 1 1 auto;
}

.table-shell--sticky .dt-footer-row .dataTables_paginate {
  flex: 1 1 0;
  justify-content: flex-end;
  min-width: 0;
}

.frean-main .table-shell--sticky .dataTables_wrapper > .row:last-child > [class*="col-"],
.frean-main .reportes-layout .reportes-table-shell .dataTables_wrapper > .row:last-child > [class*="col-"] {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  display: flex;
  align-items: center;
  min-height: 22px;
  flex: 1 1 0;
  max-width: none !important;
  width: auto !important;
}

.frean-main .table-shell--sticky .dataTables_wrapper > .row:last-child > [class*="col-"]:first-child,
.frean-main .reportes-layout .reportes-table-shell .dataTables_wrapper > .row:last-child > [class*="col-"]:first-child {
  justify-content: flex-start;
  text-align: left !important;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}

.frean-main .table-shell--sticky .dataTables_wrapper > .row:last-child > [class*="col-"]:last-child,
.frean-main .reportes-layout .reportes-table-shell .dataTables_wrapper > .row:last-child > [class*="col-"]:last-child {
  justify-content: flex-end;
}

.table-shell--sticky .dt-footer-row--actions {
  align-items: center !important;
}

.table-shell--sticky .dt-footer-center {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.dt-footer-actions,
.bom-table-footer-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.frean-main .table-shell--sticky .dataTables_wrapper .dataTables_info,
.frean-main .reportes-layout .reportes-table-shell .dataTables_wrapper .dataTables_info,
.frean-main .reportes-table-shell .dataTables_wrapper .dataTables_info {
  padding-top: 0.15rem !important;
  padding-bottom: 0.2rem !important;
  margin: 0 !important;
  font-size: 0.72rem !important;
  font-weight: 500;
  line-height: 1.25 !important;
  color: #82909c;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left !important;
  min-height: 26px;
  height: auto;
}

.frean-main .table-shell--sticky .dataTables_wrapper .dataTables_paginate,
.frean-main .reportes-layout .reportes-table-shell .dataTables_wrapper .dataTables_paginate,
.frean-main .reportes-table-shell .dataTables_wrapper .dataTables_paginate {
  margin-top: 0 !important;
  padding-top: 0.15rem !important;
  padding-bottom: 0.2rem !important;
  gap: 1px;
  min-height: 26px;
  height: auto;
  align-items: center;
  float: none !important;
}

.frean-main .table-shell--sticky .dataTables_wrapper .dataTables_paginate .paginate_button,
.frean-main .reportes-layout .reportes-table-shell .dataTables_wrapper .dataTables_paginate .paginate_button,
.frean-main .reportes-table-shell .dataTables_wrapper .dataTables_paginate .paginate_button {
  min-width: 24px !important;
  height: 22px !important;
  margin-left: 0.1rem !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding: 0 0.35rem !important;
  font-size: 0.68rem !important;
  font-weight: 600 !important;
  border-radius: 5px !important;
  line-height: 22px !important;
  box-sizing: border-box;
}

.frean-main .table-shell--sticky .dataTables_wrapper .dataTables_paginate .paginate_button.previous,
.frean-main .table-shell--sticky .dataTables_wrapper .dataTables_paginate .paginate_button.next,
.frean-main .reportes-layout .reportes-table-shell .dataTables_wrapper .dataTables_paginate .paginate_button.previous,
.frean-main .reportes-layout .reportes-table-shell .dataTables_wrapper .dataTables_paginate .paginate_button.next,
.frean-main .reportes-table-shell .dataTables_wrapper .dataTables_paginate .paginate_button.previous,
.frean-main .reportes-table-shell .dataTables_wrapper .dataTables_paginate .paginate_button.next {
  min-width: auto !important;
  height: 22px !important;
  padding-left: 0.3rem !important;
  padding-right: 0.3rem !important;
  font-size: 0.66rem !important;
  line-height: 22px !important;
}

@media (max-width: 767.98px) {
  .frean-main .table-shell--sticky .dataTables_wrapper > .row:last-child {
    flex-direction: row !important;
    flex-wrap: nowrap;
    justify-content: space-between !important;
    text-align: left;
  }

  .frean-main .table-shell--sticky .dataTables_wrapper .dataTables_info {
    margin-bottom: 0 !important;
  }

  .frean-main .table-shell--sticky .dataTables_wrapper .dataTables_paginate {
    justify-content: flex-end !important;
    flex-shrink: 0;
  }
}

/* ——— BOM ver / OP nueva: barra compacta + modo en toolbar DT ——— */
body.admin-nav-rail main.app-list-page.frean-main:has(.bom-ver-layout),
body.admin-nav-rail main.app-list-page.frean-main:has(.op-nueva-layout) {
  height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  max-height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.bom-ver-layout) > .container-fluid,
body.admin-nav-rail main.app-list-page.frean-main:has(.op-nueva-layout) > .container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0.65rem !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.bom-ver-layout) .page-header-app,
body.admin-nav-rail main.app-list-page.frean-main:has(.op-nueva-layout) .page-header-app {
  flex: 0 0 auto;
}

.bom-ver-layout,
.op-nueva-layout,
.op-nueva-form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow: hidden;
}

/* Shared compact top bar (bom_ver + op_nueva + bom_form) */
.bom-ver-bar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 0.45rem;
  min-height: 0;
  padding: 0;
}

.bom-ver-bar-meta {
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.2;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bom-plan-form-inline,
.bom-bar-fields {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25rem 0.3rem;
  margin: 0;
}

.bom-plan-form-inline {
  flex: 0 1 auto;
}

.bom-bar-fields {
  flex: 1 1 auto;
  min-width: 0;
}

.bom-bar-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.bom-plan-inline-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
}

.bom-plan-form-inline--center {
  justify-content: center;
  width: 100%;
  flex: 0 0 auto;
}

.bom-plan-form-inline--lg {
  gap: 0.45rem 0.65rem;
  flex-wrap: wrap;
}

.bom-plan-form-inline--lg .bom-plan-inline-label {
  font-size: 0.78rem;
}

.bom-plan-form-inline--lg .premium-input,
.bom-plan-form-inline--lg .form-control {
  height: 42px !important;
  min-height: 42px;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
  line-height: 1.4;
  border-radius: 10px;
}

.bom-plan-form-inline--lg #bom-plan-qty {
  width: 7.5rem;
  flex: 0 0 7.5rem;
}

.bom-plan-form-inline--lg #bom-plan-deposito {
  width: auto;
  flex: 0 1 14rem;
  min-width: 10rem;
  max-width: 18rem;
}

.bom-plan-form-inline--lg .btn {
  height: 42px;
  padding: 0.55rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 12px;
  line-height: 1.2;
}

.bom-ver-layout > .bom-ver-bar-meta {
  flex: 0 0 auto;
  text-align: center;
  width: 100%;
  white-space: normal;
  margin-bottom: 0.15rem;
}

.bom-create-op-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  margin: 0;
  width: auto;
}

.frean-table-actions .btn-sm {
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.2;
}

.bom-ver-bar .form-control-sm,
.bom-ver-bar .premium-input.form-control-sm,
.bom-plan-form-inline:not(.bom-plan-form-inline--lg) .form-control-sm {
  height: 1.75rem !important;
  min-height: 1.75rem;
  padding: 0.1rem 0.35rem;
  font-size: 0.78rem;
  line-height: 1.2;
  border-radius: 6px;
}

.bom-ver-bar .btn-sm,
.bom-plan-form-inline:not(.bom-plan-form-inline--lg) .btn-sm,
.bom-panel-footer .btn-sm {
  height: 1.75rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.2;
  flex: 0 0 auto;
}

.op-nueva-obs {
  width: 6.5rem !important;
  flex: 0 1 6.5rem;
  min-width: 4.5rem;
  max-width: 8rem;
}

#op-nueva-bar-form #op-cantidad {
  width: 4.5rem;
  flex: 0 0 4.5rem;
}

#op-nueva-bar-form #op-deposito {
  width: auto;
  flex: 0 1 8rem;
  min-width: 6.5rem;
  max-width: 9rem;
}

.op-nueva-layout .bom-ver-bar .select2-container {
  flex: 0 1 14rem !important;
  min-width: 11rem !important;
  max-width: 16rem !important;
  width: auto !important;
}

.op-nueva-layout .bom-ver-bar .select2-container--bootstrap4 .select2-selection--single {
  height: 1.75rem !important;
  min-height: 1.75rem !important;
  padding: 0 0.35rem;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  border-radius: 6px;
}

.op-nueva-layout .bom-ver-bar .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  line-height: 1.2;
  padding-left: 0;
  padding-right: 1.1rem;
}

.op-nueva-layout .bom-ver-bar .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
  right: 2px !important;
}

.op-nueva-reservar {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  margin: 0;
  line-height: 1;
  flex: 0 0 auto;
}

.op-nueva-reservar input {
  margin: 0;
  vertical-align: middle;
}

.bom-form-bar-fields {
  flex: 1 1 auto;
  min-width: 0;
}

.bom-form-producto {
  min-width: 14rem;
  max-width: 20rem;
  flex: 1 1 14rem;
}

.bom-form-version {
  width: 4.5rem;
  flex: 0 0 4.5rem;
}

.bom-form-notas {
  min-width: 8rem;
  flex: 1 1 8rem;
}

.bom-form-vigente .custom-control-label {
  font-size: 0.78rem;
}

.bom-form-bar .select2-container {
  min-width: 14rem !important;
  max-width: 20rem;
}

.bom-item-row .col-producto .select2-container {
  width: 100% !important;
  max-width: 100%;
}

.bom-toolbar-cluster--params .js-bom-dep + .select2-container {
  width: 9.5rem !important;
  min-width: 7.5rem !important;
  max-width: 11rem !important;
}

.bom-plan-form-inline:not(.bom-plan-form-inline--lg) #bom-plan-qty {
  width: 4.5rem;
  flex: 0 0 4.5rem;
}

.bom-plan-form-inline:not(.bom-plan-form-inline--lg) #bom-plan-deposito {
  width: auto;
  flex: 0 1 8rem;
  min-width: 6.5rem;
  max-width: 9rem;
}

#bom-force-bruto-fields {
  display: none;
}

.bom-ver-alert {
  flex: 0 0 auto;
}

.bom-mode-toolbar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
}

.bom-toolbar-cluster {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
  height: 36px;
  min-height: 36px;
  box-sizing: border-box;
  padding: 0 0.5rem;
  border-radius: 9px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
}

.bom-toolbar-cluster-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #1d4ed8;
}

.bom-toolbar-cluster--params .bom-toolbar-cluster-label,
.bom-toolbar-cluster--modes .bom-toolbar-cluster-label {
  color: #1d4ed8;
}

.bom-toolbar-field {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
}

.bom-toolbar-field-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.bom-toolbar-cluster--params .form-control-sm,
.bom-toolbar-cluster--params .premium-input.form-control-sm {
  height: 28px !important;
  min-height: 28px !important;
  padding: 0.1rem 0.4rem;
  font-size: 0.78rem;
  border-radius: 6px;
  background: #fff;
}

.dt-unified-toolbar .bom-toolbar-cluster--params .select2-container--bootstrap4 .select2-selection--single {
  height: 28px !important;
  min-height: 28px !important;
  border-radius: 6px !important;
  padding: 0 0.35rem;
}

.dt-unified-toolbar .bom-toolbar-cluster--params .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
  padding-left: 0.15rem !important;
  font-size: 0.78rem !important;
}

.dt-unified-toolbar .bom-toolbar-cluster--params .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow {
  height: 26px !important;
}

.bom-toolbar-cluster--params .js-bom-qty {
  width: 5.25rem;
}

.bom-toolbar-cluster--params .js-bom-dep {
  width: auto;
  min-width: 7.5rem;
  max-width: 11rem;
}

.bom-view-tabs {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.15rem;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.bom-view-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  height: 28px;
  min-height: 28px;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 0.5rem;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.bom-view-tab-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #94a3b8;
}

.bom-view-tab.is-ok .bom-view-tab-dot {
  background: #22c55e;
}

.bom-view-tab.is-short .bom-view-tab-dot {
  background: #ea580c;
}

.bom-view-tab.is-neutral .bom-view-tab-dot {
  background: #64748b;
}

.bom-view-tab.is-ok.is-active {
  background: #fff;
  color: #14532d;
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.bom-view-tab.is-short.is-active {
  background: #fff;
  color: #7c2d12;
  border-color: rgba(234, 88, 12, 0.4);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.bom-view-tab.is-neutral.is-active,
.bom-view-tab.is-active {
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.bom-view-tab:hover,
.bom-view-tab:focus {
  outline: 0;
  background: rgba(255, 255, 255, 0.75);
}

.bom-view-tab-badge {
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.22rem;
  border-radius: 999px;
  background: #fbbf24;
  color: #78350f;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1rem;
  text-align: center;
}

.dt-toolbar-center .bom-mode-toolbar {
  justify-content: center;
  flex-wrap: nowrap;
  min-width: 0;
}

.bom-toolbar-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  height: 36px;
  min-height: 36px;
  box-sizing: border-box;
  max-width: 14rem;
  padding: 0 0.7rem;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.7rem;
  color: #64748b;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
}

.bom-toolbar-meta .badge-mov-pill {
  flex-shrink: 0;
  font-size: 0.62rem;
  padding: 0.08rem 0.38rem;
}

.table-shell--sticky .dt-footer-row--actions {
  min-height: 42px !important;
}

.dt-footer-actions .bom-create-op-form,
.bom-table-footer-actions .bom-create-op-form {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  margin: 0;
  width: auto;
}

.dt-footer-actions .btn-app-red,
.dt-footer-actions .btn-app-blue,
.bom-table-footer-actions .btn-app-red,
.bom-table-footer-actions .btn-app-blue {
  height: 42px !important;
  min-height: 42px !important;
  min-width: 7.5rem;
  padding: 0 1.15rem !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  border-radius: 12px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.page-header-app:has(.stock-header-kpis--bom) {
  flex-wrap: nowrap;
}

.page-header-app:has(.stock-header-kpis--bom) .page-header-title-group {
  flex-wrap: nowrap;
  min-width: 0;
}

.page-header-app:has(.stock-header-kpis--bom) h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.page-header-actions:has(.stock-header-kpis--bom) {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
}

.stock-header-kpis--bom {
  flex: 0 0 auto;
}

.page-header-actions .stock-header-kpis--bom .stock-header-kpi {
  min-width: 6.6rem;
  flex: 0 0 auto;
  overflow: visible;
}

.bom-view-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.bom-stage-hint {
  flex: 0 0 auto;
  padding: 0;
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.2;
}

.bom-view-stage > .table-shell--sticky,
.bom-view-panel .table-shell--sticky {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  margin-bottom: 0;
}

.bom-view-stage > .frean-card,
.op-nueva-empty {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin-bottom: 0;
}

.bom-view-track {
  display: grid;
  grid-template: 1fr / 1fr;
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
}

.bom-view-panel {
  grid-area: 1 / 1;
  width: 100%;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
}

.bom-view-panel.is-active {
  visibility: visible;
  pointer-events: auto;
  z-index: 1;
}

.bom-view-stage.is-loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.bom-panel-footer {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.25rem 0.15rem;
  border-top: 1px solid #edf1f5;
  background: #fff;
  z-index: 2;
}

.bom-ver-actions {
  margin-top: 0.1rem;
}

.bom-ver-actions .bom-create-op-form {
  justify-content: center;
}

.bom-panel-footer .mr-auto {
  margin-right: auto !important;
}

.bom-panel-footer .btn.disabled,
.bom-panel-footer .btn:disabled,
.bom-table-footer-actions .btn.disabled,
.bom-table-footer-actions .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.bom-force-bruto-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.72rem;
  font-weight: 650;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}

.bom-force-bruto-toggle input {
  margin: 0;
}

.bom-force-bruto-row > td {
  background: #fff7ed !important;
  box-shadow: inset 3px 0 0 #f97316;
}

.bom-force-bruto-row.table-warning > td {
  background: #ffedd5 !important;
}

.bom-force-bruto-toggle:has(input:checked) {
  color: #c2410c;
}

.bom-mp-child-row td {
  background: #f8fafc;
  font-size: 0.9em;
}

.bom-mp-child-row--bruto td {
  background: #fffbeb;
  box-shadow: inset 3px 0 0 #fdba74;
}

.bom-ver-layout table.table tbody tr.bom-row-short > td,
.bom-ver-layout table.dataTable tbody tr.bom-row-short > td,
.bom-ver-layout .dataTables_scrollBody tbody tr.bom-row-short > td {
  background-color: #fff8eb !important;
}

.bom-ver-layout table.table-hover tbody tr.bom-row-short:hover,
.bom-ver-layout table.table-hover tbody tr.bom-row-short:hover > td,
.bom-ver-layout table.dataTable tbody tr.bom-row-short:hover > td {
  background-color: #fef3c7 !important;
  box-shadow: none;
}

.bom-ver-layout tbody tr.bom-row-short > td:first-child {
  box-shadow: inset 3px 0 0 #f3d38a;
}

.bom-ver-layout tbody tr.bom-row-short:hover > td:first-child {
  box-shadow: inset 3px 0 0 #e8b84a;
}

.bom-ver-layout tbody tr.bom-row-short td code {
  background-color: transparent !important;
}

.bom-ver-layout table.table tbody tr.table-warning > td,
.bom-ver-layout table.dataTable tbody tr.table-warning > td,
.bom-ver-layout table.table tbody tr.table-warning:hover > td,
.bom-ver-layout table.dataTable tbody tr.table-warning:hover > td,
.bom-mp-child-row.table-warning td,
.bom-mp-child-row--bruto.table-warning td {
  background-color: transparent !important;
}

.bom-mp-child-label {
  padding-left: 1.15rem !important;
  color: #475569;
}

.bom-op-link {
  text-decoration: none !important;
}

.bom-op-link:hover .badge-mov-pill,
.bom-op-link:focus .badge-mov-pill {
  filter: brightness(0.95);
}

@media (max-width: 767.98px) {
  .bom-ver-bar {
    flex-wrap: wrap;
  }

  .bom-plan-form-inline,
  .bom-bar-fields {
    flex: 1 1 100%;
    width: 100%;
  }

  .bom-bar-actions {
    margin-left: auto;
  }

  .bom-plan-form-inline #bom-plan-deposito,
  #op-nueva-bar-form #op-deposito {
    flex: 1 1 auto;
    max-width: none;
  }

  .bom-ver-bar-meta {
    white-space: normal;
  }
}

/* ——— Avisos unificados Frean ——— */
.frean-notice-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}

.frean-notice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0 0 0.65rem;
  padding: 0.75rem 0.85rem 0.75rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: 0 10px 28px -16px rgba(15, 23, 42, 0.35), 0 1px 0 rgba(255, 255, 255, 0.65) inset;
  overflow: hidden;
  animation: freanNoticeIn 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.frean-notice-stack .frean-notice {
  margin: 0;
  pointer-events: auto;
}

.frean-notice::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: currentColor;
  opacity: 0.85;
}

.frean-notice-icon {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.04);
  animation: freanNoticePulse 1.8s ease-in-out infinite;
}

.frean-notice-body {
  flex: 1 1 auto;
  min-width: 0;
}

.frean-notice-title {
  margin: 0 0 0.15rem;
  font-size: 0.84rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  color: inherit;
}

.frean-notice-text {
  font-size: 0.8rem;
  line-height: 1.35;
  color: inherit;
  opacity: 0.92;
}

.frean-notice-text p {
  margin: 0 0 0.25rem;
}

.frean-notice-text p:last-child {
  margin-bottom: 0;
}

.frean-notice-close {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  margin: -0.15rem -0.2rem 0 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  opacity: 0.55;
  line-height: 1;
  font-size: 1.15rem;
  cursor: pointer;
}

.frean-notice-close:hover {
  opacity: 1;
  background: rgba(15, 23, 42, 0.06);
}

.frean-notice--error {
  color: #9f1239;
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  border-color: #fecdd3;
}

.frean-notice--success {
  color: #166534;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #bbf7d0;
}

.frean-notice--warning {
  color: #9a3412;
  background: linear-gradient(135deg, #fffbeb 0%, #ffedd5 100%);
  border-color: #fed7aa;
}

.frean-notice--info {
  color: #0e7490;
  background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
  border-color: #a5f3fc;
}

.frean-notice.is-leaving {
  animation: freanNoticeOut 0.28s ease forwards;
}

@keyframes freanNoticeIn {
  from {
    opacity: 0;
    transform: translateY(0.55rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes freanNoticeOut {
  to {
    opacity: 0;
    transform: translateY(0.35rem) scale(0.98);
  }
}

@keyframes freanNoticePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

/* Bootstrap alerts → misma línea visual */
.frean-main .alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border-radius: 12px;
  border-width: 1px;
  box-shadow: 0 8px 22px -16px rgba(15, 23, 42, 0.28);
  padding: 0.75rem 0.9rem;
  animation: freanNoticeIn 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.frean-main .alert::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 12px 0 0 12px;
}

.frean-main .alert-danger {
  color: #9f1239;
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  border-color: #fecdd3;
}

.frean-main .alert-danger::before {
  background: #e11d48;
}

.frean-main .alert-success {
  color: #166534;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #bbf7d0;
}

.frean-main .alert-success::before {
  background: #16a34a;
}

.frean-main .alert-warning {
  color: #9a3412;
  background: linear-gradient(135deg, #fffbeb 0%, #ffedd5 100%);
  border-color: #fed7aa;
}

.frean-main .alert-warning::before {
  background: #ea580c;
}

.frean-main .alert-info {
  color: #0e7490;
  background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
  border-color: #a5f3fc;
}

.frean-main .alert-info::before {
  background: #0891b2;
}

.orden-form-alert .frean-notice,
.maestro-form-alert .frean-notice {
  margin-bottom: 0.5rem;
}

/* Check animado en toasts de éxito */
.frean-notice-check {
  flex: 0 0 auto;
  width: 2.15rem;
  height: 2.15rem;
}

.frean-notice-check-svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  stroke: #16a34a;
  stroke-width: 3;
  stroke-miterlimit: 10;
  box-shadow: inset 0 0 0 0 rgba(22, 163, 74, 0.15);
  animation: freanCheckFill 0.35s ease-in-out 0.35s forwards;
}

.frean-notice-check-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 2.5;
  stroke-linecap: round;
  animation: freanCheckStroke 0.55s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.frean-notice-check-mark {
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: freanCheckStroke 0.28s cubic-bezier(0.65, 0, 0.45, 1) 0.5s forwards;
}

@keyframes freanCheckStroke {
  100% { stroke-dashoffset: 0; }
}

@keyframes freanCheckFill {
  100% {
    box-shadow: inset 0 0 0 1.1rem rgba(22, 163, 74, 0.12);
  }
}

/* Detalle cobro/pago: paneles sticky */
body.admin-nav-rail main.app-list-page.frean-main:has(.cobro-ver-layout) {
  height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  max-height: calc(100dvh - var(--ag-nav-header-height, 4.25rem));
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.cobro-ver-layout) > .container-fluid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0.65rem !important;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.cobro-ver-layout) .page-header-app {
  flex: 0 0 auto;
}

body.admin-nav-rail main.app-list-page.frean-main:has(.cobro-ver-layout) > .container-fluid > .orden-form-alert {
  flex: 0 0 auto;
}

.cobro-ver-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0.45rem;
}

.cobro-ver-split {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.55rem;
  overflow: hidden;
}

.cobro-ver-split .cobro-panel {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 991.98px) {
  .cobro-ver-split {
    flex-direction: column;
    overflow: auto;
  }

  .cobro-ver-split .cobro-panel {
    min-height: 14rem;
  }
}

/* Reportes / IVA Contador / Configuración */
.reportes-layout,
.iva-layout,
.config-layout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.iva-layout {
  flex: 1 1 auto;
  overflow: hidden;
}

.reportes-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid var(--frean-border, #e5e7eb);
  border-radius: 14px;
  box-shadow: var(--frean-card-shadow, 0 1px 3px rgba(0,0,0,.06));
}

.reportes-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #64748b;
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.reportes-nav-item i {
  font-size: 0.95rem;
  opacity: 0.85;
}

.reportes-nav-item:hover {
  color: #0f172a;
  background: #f8fafc;
  text-decoration: none;
}

.reportes-nav-item.is-active {
  color: #0f172a;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 70%);
  border-color: #bfdbfe;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.12);
}

.reportes-nav-item.is-active i {
  color: #2563eb;
  opacity: 1;
}

.reportes-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  padding: 0.65rem 0.85rem;
}

.reportes-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem 0.75rem;
  padding: 0.45rem 0.65rem;
}

.reportes-controls > .reportes-subnav {
  justify-self: start;
}

.reportes-controls > .reportes-nav,
.reportes-controls > .empleado-ver-tabs {
  justify-self: start;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

.reportes-controls > .reportes-period-tag {
  justify-self: center;
}

.reportes-controls > .reportes-period-controls {
  justify-self: end;
}

.reportes-controls--period-only {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.reportes-controls--period-only > .reportes-period-tag {
  grid-column: 2;
}

.reportes-controls--period-only > .reportes-period-controls {
  grid-column: 3;
}

.reportes-controls--tabs-only {
  grid-template-columns: 1fr;
}

.reportes-controls--tabs-only > .reportes-nav,
.reportes-controls--tabs-only > .empleado-ver-tabs {
  justify-self: start;
}

.reportes-period-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin-left: 0;
}

.reportes-period-tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a5f;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.2;
}

.reportes-toolbar-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.reportes-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.reportes-subnav-item {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #64748b;
  text-decoration: none;
  border: 1px solid transparent;
}

.reportes-subnav-item:hover {
  color: #0f172a;
  background: #f1f5f9;
  text-decoration: none;
}

.reportes-subnav-item.is-active {
  color: #0f172a;
  background: #eff6ff;
  border-color: #bfdbfe;
  box-shadow: none;
}

.reportes-presets button.reportes-preset {
  cursor: pointer;
  font-family: inherit;
}

.reportes-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  flex-shrink: 0;
}

.reportes-list-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.reportes-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 7px;
  border: 1px solid #dbe3ea;
  background: #fff;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.reportes-expand-btn:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
}

.reportes-expand-btn i {
  font-size: 0.7rem;
}

.reportes-list-card.is-collapsed .reportes-list-body {
  display: none;
}

.reportes-list-card.is-collapsed .reportes-list-head {
  margin-bottom: 0;
}

.reportes-list-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.dashboard-card.is-collapsed .dashboard-state-toggles {
  display: none !important;
}

.reportes-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.reportes-field .form-control {
  min-width: 9.5rem;
}

.reportes-presets {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.2rem;
  background: #f1f5f9;
  border-radius: 999px;
}

.reportes-preset {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  text-decoration: none;
  border: 0;
  background: transparent;
}

.reportes-preset:hover {
  color: #0f172a;
  background: rgba(255,255,255,0.75);
  text-decoration: none;
}

.reportes-preset.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.reportes-period {
  font-size: 0.8rem;
  white-space: nowrap;
}

@media (max-width: 991.98px) {
  .reportes-controls,
  .reportes-controls--period-only {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .reportes-controls > .reportes-subnav,
  .reportes-controls > .reportes-nav,
  .reportes-controls > .empleado-ver-tabs,
  .reportes-controls > .reportes-period-tag,
  .reportes-controls > .reportes-period-controls,
  .reportes-controls--period-only > .reportes-period-tag,
  .reportes-controls--period-only > .reportes-period-controls {
    justify-self: stretch;
    grid-column: auto;
  }

  .reportes-period-controls {
    width: 100%;
  }

  .reportes-period-tag {
    justify-content: center;
    white-space: normal;
    text-align: center;
  }
}

.reportes-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
}

/* Ficha empleado: pestañas + período en una sola barra; pares de misma altura */
.empleado-ver-layout .reportes-pair,
.empleado-ver-layout .empleado-ver-pair {
  --reportes-pair-h: auto;
  align-items: stretch;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.empleado-ver-layout .reportes-pair > .reportes-list-card,
.empleado-ver-layout .empleado-ver-pair > .reportes-list-card {
  height: auto;
  max-height: none;
  min-height: 0;
  overflow: hidden;
}
.empleado-ver-layout .empleado-ver-pair--tables {
  --reportes-pair-h: 560px;
}
.empleado-ver-layout .empleado-ver-pair--tables > .reportes-list-card {
  height: var(--reportes-pair-h);
  max-height: var(--reportes-pair-h);
  overflow: hidden;
}
@media (max-width: 900px) {
  .empleado-ver-layout .reportes-pair,
  .empleado-ver-layout .empleado-ver-pair {
    grid-template-columns: 1fr;
  }
  .empleado-ver-layout .empleado-ver-pair--tables > .reportes-list-card {
    height: auto;
    max-height: none;
    min-height: 320px;
  }
}
.empleado-ver-dl {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0.15rem 0.15rem 0.35rem;
}
.empleado-ver-dl-row {
  display: grid;
  grid-template-columns: minmax(7rem, 9.5rem) minmax(0, 1fr);
  gap: 0.35rem 1rem;
  padding: 0.55rem 0.35rem;
  border-bottom: 1px solid var(--frean-border, #eef2f7);
}
.empleado-ver-dl-row:last-child {
  border-bottom: 0;
}
.empleado-ver-dl-row dt {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.empleado-ver-dl-row dd {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}
html[data-theme="dark"] .empleado-ver-dl-row {
  border-bottom-color: rgba(148, 163, 184, 0.18);
}
html[data-theme="dark"] .empleado-ver-dl-row dt {
  color: #94a3b8;
}
html[data-theme="dark"] .empleado-ver-dl-row dd {
  color: #e2e8f0;
}
@media (max-width: 640px) {
  .empleado-ver-dl-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

.empleado-horario-builder {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--frean-border, #e5e7eb);
  border-radius: 12px;
  background: #f8fafc;
}
.empleado-horario-dias {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.empleado-horario-chip {
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
  user-select: none;
}
.empleado-horario-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.empleado-horario-chip span {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.empleado-horario-chip input:checked + span {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.empleado-horario-times {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}
.empleado-horario-times .premium-input {
  max-width: 8.5rem;
}
.empleado-horario-sep {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
}
.empleado-horario-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--frean-border, #e5e7eb);
  border-radius: 12px;
  background: #f8fafc;
}
.empleado-horario-row {
  display: grid;
  grid-template-columns: minmax(7.5rem, 9rem) minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.4rem 0.55rem;
  align-items: center;
}
.empleado-horario-row.is-off {
  opacity: 0.55;
}
.empleado-horario-view {
  display: flex;
  flex-direction: column;
  padding: 0.15rem 0.35rem 0.35rem;
}
.empleado-horario-view-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(5.5rem, 0.7fr);
  gap: 0.35rem 1rem;
  padding: 0.55rem 0.35rem;
  border-bottom: 1px solid var(--frean-border, #eef2f7);
  align-items: center;
}
.empleado-horario-view-row:last-child { border-bottom: 0; }
.empleado-horario-view-row.is-off { opacity: 0.65; }
.empleado-horario-view-day {
  font-size: 0.86rem;
  font-weight: 700;
  color: #334155;
}
.empleado-horario-view-range {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
html[data-theme="dark"] .empleado-horario-builder,
html[data-theme="dark"] .empleado-horario-grid {
  background: rgba(15, 23, 42, 0.45);
  border-color: rgba(148, 163, 184, 0.22);
}
html[data-theme="dark"] .empleado-horario-chip span {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(148, 163, 184, 0.28);
  color: #cbd5e1;
}
html[data-theme="dark"] .empleado-horario-chip input:checked + span {
  background: rgba(37, 99, 235, 0.22);
  border-color: rgba(96, 165, 250, 0.55);
  color: #bfdbfe;
}
html[data-theme="dark"] .empleado-horario-view-row {
  border-bottom-color: rgba(148, 163, 184, 0.18);
}
html[data-theme="dark"] .empleado-horario-view-day { color: #cbd5e1; }
html[data-theme="dark"] .empleado-horario-view-range { color: #e2e8f0; }
@media (max-width: 640px) {
  .empleado-horario-row {
    grid-template-columns: 1fr 1fr;
  }
  .empleado-horario-row .custom-control {
    grid-column: 1 / -1;
  }
  .empleado-horario-view-row {
    grid-template-columns: 1fr;
  }
  .empleado-horario-view-range {
    text-align: left;
  }
}

.reportes-kpi-grid {
  width: 100%;
  margin-bottom: 0;
}

.reportes-pair {
  --reportes-pair-h: 480px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: stretch;
}

.reportes-pair--tall {
  --reportes-pair-h: 560px;
}

.reportes-pair:has(.reportes-list-card) {
  --reportes-pair-h: 560px;
}

.reportes-pair--cheques {
  --reportes-pair-h: 640px;
}

.reportes-pair > .dashboard-card,
.reportes-pair > .reportes-list-card {
  height: var(--reportes-pair-h);
  max-height: var(--reportes-pair-h);
  min-height: 0;
  overflow: hidden;
}

.reportes-chart-card {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.reportes-chart-card--wide {
  width: 100%;
  height: auto;
  max-height: none;
}

.reportes-chart-card .dashboard-card-body {
  flex: 1 1 auto;
  padding-top: 0.25rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.reportes-chart-card .dashboard-state-toggles {
  display: none !important;
  margin: 0;
}

/* Altura fija del par: el gráfico llena el cuerpo sin expandir la card */
.reportes-pair .reportes-chart-card .dashboard-chart-wrap {
  flex: 1 1 auto;
  height: auto !important;
  min-height: 0;
}

.reportes-doughnut-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 0.55rem 0.75rem;
  align-items: center;
  justify-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.reportes-doughnut-layout .dashboard-chart-wrap {
  min-height: 0;
  height: 100% !important;
  align-self: stretch;
}

.reportes-doughnut-stats {
  --rd-card-w: 8.6rem;
  display: grid;
  grid-template-columns: repeat(2, var(--rd-card-w));
  gap: 0.4rem;
  align-content: center;
  justify-content: start;
  align-self: center;
  width: max-content;
  max-width: 100%;
  flex: 0 0 auto;
  overflow: visible;
}

.reportes-doughnut-stat {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.08rem;
  width: var(--rd-card-w);
  min-height: 4.35rem;
  padding: 0.42rem 0.5rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid var(--stat-color, #94a3b8);
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.reportes-doughnut-stat input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.reportes-doughnut-stat.is-off {
  opacity: 0.5;
  filter: grayscale(0.45);
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.reportes-doughnut-stat.is-off .reportes-doughnut-stat-label,
.reportes-doughnut-stat.is-off .reportes-doughnut-stat-value,
.reportes-doughnut-stat.is-off .reportes-doughnut-stat-pct {
  color: #94a3b8;
  text-decoration: line-through;
}

.dashboard-state-toggles {
  display: none !important;
}

.reportes-doughnut-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  line-height: 1.2;
  white-space: normal;
}

.reportes-doughnut-stat-value {
  font-size: 0.98rem;
  font-weight: var(--font-weight-bold, 700);
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reportes-doughnut-stat-pct {
  font-size: 0.76rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.reportes-list-card {
  min-width: 0;
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.reportes-list-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: var(--font-weight-bold, 700);
  color: #0f172a;
}

.reportes-table-shell {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reportes-table-shell .dataTables_wrapper {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.reportes-table-shell .dt-unified-toolbar-row {
  flex-shrink: 0;
}

.reportes-dt-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto !important;
  height: auto !important;
  max-height: none !important;
}

/* Cabecera fija al scrollear (mismo criterio que stock / líneas) */
.reportes-dt-scroll > table {
  border-collapse: separate;
  border-spacing: 0;
}

.reportes-dt-scroll > table thead th,
.frean-main .reportes-dt-scroll > table.dataTable thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, #f5f9fc 0%, #edf4f8 100%);
  box-shadow: 0 1px 0 #d9e4ec;
}

.reportes-pair .reportes-table-shell .dataTables_wrapper > .row:last-child {
  flex-shrink: 0;
}

.reportes-table-shell .dataTables_wrapper > .row:last-child {
  flex-shrink: 0;
}

.reportes-table-shell .dt-unified-toolbar {
  grid-template-columns: auto 1fr auto;
}

.reportes-sticky-shell {
  height: min(520px, 64vh);
  min-height: 320px;
}

.reportes-list-card--sticky {
  height: auto;
  max-height: none;
}

.reportes-list-card--sticky .reportes-list-body {
  flex: 1 1 auto;
  min-height: 0;
}

@media (max-width: 991.98px) {
  .reportes-pair > .dashboard-card,
  .reportes-pair > .reportes-list-card {
    height: auto;
    max-height: none;
    min-height: var(--reportes-pair-h);
  }

  .reportes-pair .reportes-chart-card .dashboard-chart-wrap {
    height: 240px !important;
    flex: 0 0 auto;
  }

  .reportes-pair .reportes-dt-scroll {
    height: 240px !important;
    max-height: 240px !important;
  }
}

@media (max-width: 575.98px) {
  .reportes-doughnut-layout {
    grid-template-columns: 1fr;
  }

  .reportes-doughnut-stats {
    width: 100%;
    --rd-card-w: minmax(0, 1fr);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reportes-doughnut-stat {
    width: auto;
  }
}

.reportes-hint {
  font-size: 0.85rem;
  padding: 0.15rem 0.1rem;
}

.reportes-hint a {
  font-weight: 600;
}

/* Compat tabs (IVA / config) */
.reportes-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.15rem;
  background: #f1f5f9;
  border-radius: 0.55rem;
}

.reportes-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  border: 0;
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.reportes-tab:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
  text-decoration: none;
}

.reportes-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.reportes-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.2rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
}

.reportes-tab.is-active .reportes-tab-count {
  background: #dbeafe;
  color: #1d4ed8;
}

.iva-summary-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  flex: 0 0 auto;
}

.iva-book-shell {
  flex: 1 1 auto;
  min-height: 22rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
}

.iva-book-shell > .table-shell--sticky {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  border-radius: 0;
}

.iva-summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.iva-summary-item .label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.iva-summary-item strong {
  font-size: 0.95rem;
  color: #0f172a;
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
  overflow: hidden;
  display: block;
  width: 100%;
  min-width: 0;
  line-height: 1.2;
}

.iva-comp-cell {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
  max-width: 100%;
}

.iva-comp-num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  text-decoration: none;
}

.iva-comp-num:hover {
  color: var(--frean-accent, #308fbe);
  text-decoration: underline;
}

.iva-layout > .reportes-controls {
  flex: 0 0 auto;
}

.btn-excel {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #217346;
  border-color: #1e6b40;
  color: #fff !important;
  font-weight: 600;
}

.btn-excel:hover,
.btn-excel:focus {
  background: #1a5c38;
  border-color: #174f30;
  color: #fff !important;
}

.btn-excel i {
  font-size: 1rem;
  line-height: 1;
}

.config-panel {
  padding: 0;
  overflow: hidden;
}

.config-panel .maestro-form-scroll {
  padding: 0.85rem 1rem 0.35rem;
}

.config-panel .frean-form-actions--footer {
  padding: 0.55rem 1rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.config-panel--pagos {
  padding: 1rem 1.1rem;
}

/* Imputación de cheque */
.cheque-imputar-layout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.cheque-imputar-summary {
  margin-bottom: 0 !important;
}

.cheque-imputar-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.85rem 1rem 0.65rem !important;
}

.cheque-imputar-meta {
  margin-bottom: 0.35rem;
}

.cheque-imputar-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
}

.cheque-imputar-shell {
  flex: 1 1 auto;
  min-height: 12rem;
  max-height: min(52vh, 28rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
}

.cheque-imputar-shell .operacion-lines-scroll {
  flex: 1 1 auto;
  min-height: 0;
}

.cheque-imputar-col-check {
  width: 2.4rem;
  text-align: center;
}

.cheque-imputar-col-monto {
  width: 8.5rem;
}

.cheque-imputar-col-monto .fact-monto {
  text-align: right;
}

.cheque-imputar-total {
  font-size: 0.95rem;
}

@media (max-width: 991.98px) {
  .reportes-pair {
    grid-template-columns: 1fr;
  }

  .reportes-period {
    margin-left: 0;
    width: 100%;
  }

  .iva-summary-bar {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-card-head--facturacion {
    grid-template-columns: 1fr;
  }

  .dashboard-card-head--facturacion .dashboard-period-pills {
    justify-self: start;
  }

  .cheque-imputar-shell {
    max-height: none;
  }
}

/* ——— Tipografía: jerarquía (cuerpo regular; negrita solo en títulos y énfasis) ——— */
body.frean-login {
  font-weight: var(--font-weight-regular, 400);
}

body.frean-login label,
body.frean-login .font-weight-bold {
  font-weight: var(--font-weight-medium, 500);
}

.frean-main p,
.frean-main li,
.frean-main td,
.frean-main .table tbody td,
.frean-main table.dataTable tbody td,
.frean-main .form-control,
.frean-main .premium-input,
.frean-main textarea,
.frean-main select,
.frean-main .select2-container--bootstrap4 .select2-selection__rendered,
.frean-main .page-header-sub,
.frean-main .text-muted {
  font-weight: var(--font-weight-regular, 400);
}

.frean-main label,
.frean-main .premium-label,
.frean-main .form-group label,
.frean-main .small.font-weight-bold,
.frean-main .cobro-form-block-title,
.frean-main .cobro-panel-meta,
.frean-main .stock-header-kpi .label,
.frean-main .stat-tile .label,
.frean-main .reportes-toolbar-label,
.frean-main .bom-toolbar-field-label {
  font-weight: var(--font-weight-medium, 500);
}

.frean-main .table thead th,
.frean-main table.dataTable thead th,
.frean-main .nav-tabs-compact .nav-link,
.frean-main .badge,
.frean-main .badge-cae,
.frean-main .badge-anulado,
.frean-main .badge-mov-pill {
  font-weight: var(--font-weight-semibold, 600);
}

.frean-main strong,
.frean-main b,
.frean-main .font-weight-bold,
.frean-main .celda-monto.font-weight-bold,
.frean-main .comprobante-cobro-num,
.frean-main .comprobante-cobro-amt {
  font-weight: var(--font-weight-semibold, 600);
}

.frean-main h1,
.frean-main h2,
.frean-main .page-header-app h1,
.frean-main .modal-title,
.frean-main .stat-tile .value,
.frean-main .stock-header-kpi .value,
.frean-main .operacion-ver-oc-num {
  font-weight: var(--font-weight-bold, 700);
}

.frean-main h3,
.frean-main h4,
.frean-main h5,
.frean-main h6 {
  font-weight: var(--font-weight-semibold, 600);
}

.btn-app-blue,
.btn-app-green,
.btn-app-red,
.btn-app-orange,
.btn-new-item,
.btn-toolbar-primary,
.btn-toolbar-blue,
.btn-toolbar-view,
.app-list-page .btn-outline-danger,
.app-list-page .btn-outline-primary,
.btn-outline-danger.btn-premium,
.btn-outline-primary.btn-premium {
  font-weight: var(--font-weight-semibold, 600) !important;
}

.frean-brand,
.frean-nav-logo {
  font-weight: var(--font-weight-bold, 700) !important;
}

.ag-sidebar-list .ag-nav-section span {
  font-weight: var(--font-weight-semibold, 600);
}

/* Móvil: no bloquear el alto de la ventana. El lock de viewport (overflow:hidden)
   recorta título/botones y no deja scrollear. */
@media (max-width: 767.98px) {
  html,
  body.admin-nav-rail {
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body.admin-nav-rail main.app-list-page.frean-main,
  body.admin-nav-rail main.app-list-page.frean-main:has(.orden-form-layout),
  body.admin-nav-rail main.app-list-page.frean-main:has(.cobro-form-layout),
  body.admin-nav-rail main.app-list-page.frean-main:has(.cc-layout),
  body.admin-nav-rail main.app-list-page.frean-main:has(.maestro-form-layout),
  body.admin-nav-rail main.app-list-page.frean-main:has(.caja-layout),
  body.admin-nav-rail main.app-list-page.frean-main:has(.stock-page-layout),
  body.admin-nav-rail main.app-list-page.frean-main:has(.table-shell--sticky) {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body.admin-nav-rail main.app-list-page.frean-main > .container-fluid {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
  }

  .orden-form-layout,
  .cobro-form-layout,
  form.frean-form-oc,
  .frean-items-shell,
  .orden-form-layout > .table-shell.frean-items-shell,
  .frean-items-scroll,
  .operacion-lines-scroll,
  .table-shell--sticky,
  .table-shell--sticky .dataTables_wrapper,
  .table-shell--sticky .dataTables_scroll,
  .table-shell--sticky .dataTables_scrollBody,
  .stock-page-layout,
  .stock-panels-stage,
  .stock-panel,
  .cc-layout,
  .caja-layout,
  .maestro-form-layout {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    flex: none !important;
  }
}




/* ========== License renewal gate (overlay) ========== */
.license-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.license-gate-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}
.license-gate-card {
  position: relative;
  z-index: 1;
  width: min(32rem, 100%);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  padding: 1.6rem 1.5rem 1.35rem;
  overflow: hidden;
  animation: license-gate-in 0.28s ease;
}
@keyframes license-gate-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.license-gate-accent {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 5px;
}
.license-gate-accent.is-grace {
  background: linear-gradient(90deg, #f59e0b, #fbbf24, #f97316);
}
.license-gate-accent.is-hard {
  background: linear-gradient(90deg, #dc2626, #f43f5e, #e11d48);
}
.license-gate-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  background: #fff7ed;
  color: #c2410c;
}
.license-gate-accent.is-hard + .license-gate-icon,
.license-gate-card:has(.is-hard) .license-gate-icon {
  background: #fef2f2;
  color: #b91c1c;
}
.license-gate-title {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}
.license-gate-lead {
  margin: 0 0 0.35rem;
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.45;
}
.license-gate-company {
  margin: 0 0 1rem;
  font-weight: 700;
  color: var(--frean-navy, #1e293b);
  font-size: 0.95rem;
}
.license-gate-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}
.license-gate-stat {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
}
.license-gate-stat .label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.15rem;
}
.license-gate-stat strong {
  font-size: 1rem;
  color: #0f172a;
}
.license-gate-stat strong.is-warn { color: #c2410c; }
.license-gate-stat strong.is-ok { color: #15803d; }
.license-gate-stat strong.is-bad { color: #b91c1c; }
.license-gate-note {
  margin: 0 0 1rem;
  font-size: 0.86rem;
  color: #64748b;
}
.license-gate-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.license-gate-btn-renew,
.license-gate-btn-later {
  width: 100%;
  justify-content: center;
  font-weight: 700;
  padding: 0.65rem 1rem;
  border-radius: 10px;
}
.license-gate-hint {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  color: #94a3b8;
}
.license-gate-hint--hard {
  color: #b91c1c;
  font-weight: 600;
}
@media (max-width: 480px) {
  .license-gate-stats { grid-template-columns: 1fr; }
}

/* —— Tema oscuro: página + títulos + superficies —— */
html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] body.admin-nav-rail,
html[data-theme="dark"] body.listado-body-bg {
  background: var(--ag-nav-page) !important;
  background-color: var(--ag-nav-page) !important;
  color: var(--color-text);
}

html[data-theme="dark"] main.app-list-page,
html[data-theme="dark"] main.app-list-page.frean-main,
html[data-theme="dark"] .frean-main,
html[data-theme="dark"] .frean-main > .container-fluid {
  background: var(--ag-nav-page) !important;
  background-color: var(--ag-nav-page) !important;
  color: var(--color-text);
}

html[data-theme="dark"] .page-header-app h1,
html[data-theme="dark"] .frean-main .page-header-app h1,
html[data-theme="dark"] .page-header-panel h1,
html[data-theme="dark"] body.admin-nav-rail main.app-list-page.frean-main .page-header-app h1,
html[data-theme="dark"] body.admin-nav-rail main.app-list-page.frean-main .page-header-app--split h1 {
  color: var(--color-text) !important;
}

html[data-theme="dark"] .page-header-app p,
html[data-theme="dark"] .frean-main .page-header-app p,
html[data-theme="dark"] .page-header-sub,
html[data-theme="dark"] .frean-main .text-muted {
  color: var(--color-muted) !important;
}

html[data-theme="dark"] .frean-card,
html[data-theme="dark"] .table-shell,
html[data-theme="dark"] .stat-tile,
html[data-theme="dark"] .dashboard-card,
html[data-theme="dark"] .dash-kpi,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .select2-container--bootstrap4 .select2-selection--single,
html[data-theme="dark"] .frean-main .form-control,
html[data-theme="dark"] .frean-main .premium-input,
html[data-theme="dark"] .frean-main .custom-select {
  background: var(--ag-nav-surface) !important;
  color: var(--color-text) !important;
  border-color: var(--color-border) !important;
}

html[data-theme="dark"] .frean-main .table,
html[data-theme="dark"] .frean-main .table thead th,
html[data-theme="dark"] .frean-main .table td,
html[data-theme="dark"] .frean-main .table th {
  color: var(--color-text);
  border-color: var(--color-border) !important;
  background-color: transparent;
}

html[data-theme="dark"] .frean-main .table thead th {
  background: var(--table-head-bg) !important;
}

html[data-theme="dark"] .frean-main .table-striped tbody tr:nth-of-type(odd),
html[data-theme="dark"] .frean-main .table tbody tr:nth-child(even) {
  background-color: var(--color-row-alt);
}

html[data-theme="dark"] .frean-main .table tbody tr:hover {
  background-color: var(--color-row-hover) !important;
}

html[data-theme="dark"] .operacion-ver-layout tbody tr.op-mat-row-short > td {
  background-color: rgba(251, 191, 36, 0.12) !important;
}

html[data-theme="dark"] .operacion-ver-layout tbody tr.op-mat-row-short:hover > td {
  background-color: rgba(251, 191, 36, 0.18) !important;
}

html[data-theme="dark"] .bom-ver-layout table.table tbody tr.bom-row-short > td,
html[data-theme="dark"] .bom-ver-layout table.dataTable tbody tr.bom-row-short > td,
html[data-theme="dark"] .bom-ver-layout .dataTables_scrollBody tbody tr.bom-row-short > td {
  background-color: rgba(251, 191, 36, 0.12) !important;
}

html[data-theme="dark"] .bom-ver-layout table.table-hover tbody tr.bom-row-short:hover > td {
  background-color: rgba(251, 191, 36, 0.18) !important;
}

html[data-theme="dark"] .ag-mobile-topbar {
  background: var(--ag-nav-surface);
  box-shadow: 0 8px 24px rgb(0 0 0 / 35%);
}

html[data-theme="dark"] .ag-mobile-brand-name,
html[data-theme="dark"] .ag-mobile-menu-btn {
  color: var(--ag-nav-text);
}

html[data-theme="dark"] .ag-mobile-menu-btn {
  background: var(--ag-nav-chip);
}

html[data-theme="dark"] .btn-page-info {
  color: var(--color-muted);
}

html[data-theme="dark"] .page-help-modal .modal-header,
html[data-theme="dark"] .page-help-modal .modal-body {
  background: var(--ag-nav-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

html[data-theme="dark"] .select2-dropdown {
  background: var(--ag-nav-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

html[data-theme="dark"] .select2-container--bootstrap4 .select2-results__option--highlighted {
  background: var(--ag-nav-active-bg);
  color: var(--ag-nav-active-color);
}

html[data-theme="dark"] .flatpickr-calendar {
  background: var(--ag-nav-surface);
  box-shadow: var(--shadow-card);
  color: var(--color-text);
}

html[data-theme="dark"] .swal2-popup {
  background: var(--ag-nav-surface) !important;
  color: var(--color-text) !important;
}

html[data-theme="dark"] .dashboard-card-title,
html[data-theme="dark"] .dashboard-note-title,
html[data-theme="dark"] .dash-kpi .label,
html[data-theme="dark"] .dash-kpi .value {
  color: var(--color-text) !important;
}

/* Botones primarios (Guardar / Guardar AFIP) */
html[data-theme="dark"] .btn-app-blue,
html[data-theme="dark"] .frean-main .btn-app-blue,
html[data-theme="dark"] .frean-main .btn-primary,
html[data-theme="dark"] .btn.btn-app-blue {
  background: linear-gradient(135deg, #5eb8f0, #3aa0e0) !important;
  border-color: #5eb8f0 !important;
  color: #0b1220 !important;
  box-shadow: 0 4px 14px rgb(94 184 240 / 28%) !important;
  font-weight: 700;
}

html[data-theme="dark"] .btn-app-blue:hover,
html[data-theme="dark"] .frean-main .btn-app-blue:hover,
html[data-theme="dark"] .frean-main .btn-primary:hover {
  background: linear-gradient(135deg, #7ec8f5, #5eb8f0) !important;
  border-color: #7ec8f5 !important;
  color: #0b1220 !important;
}

html[data-theme="dark"] .btn-app-orange,
html[data-theme="dark"] .frean-main .btn-app-orange {
  background: linear-gradient(135deg, #f5c84a, #e3a008) !important;
  border-color: #f5c84a !important;
  color: #1a1403 !important;
}

html[data-theme="dark"] .btn-app-orange:hover,
html[data-theme="dark"] .frean-main .btn-app-orange:hover {
  background: linear-gradient(135deg, #f8d56a, #f5c84a) !important;
  border-color: #f8d56a !important;
  color: #1a1403 !important;
}

/* Reportes — nav de áreas */
html[data-theme="dark"] .reportes-nav {
  background: var(--ag-nav-surface) !important;
  border-color: var(--color-border) !important;
  box-shadow: var(--shadow-card);
}

html[data-theme="dark"] .reportes-nav-item {
  color: var(--color-muted) !important;
}

html[data-theme="dark"] .reportes-nav-item:hover {
  color: var(--color-text) !important;
  background: var(--ag-nav-chip) !important;
}

html[data-theme="dark"] .reportes-nav-item.is-active {
  color: var(--color-text) !important;
  background: var(--ag-nav-active-bg) !important;
  border-color: rgb(94 184 240 / 35%) !important;
  box-shadow: none;
}

html[data-theme="dark"] .reportes-nav-item.is-active i {
  color: var(--ag-nav-active-color) !important;
}

/* Tabs config / IVA */
html[data-theme="dark"] .reportes-tabs {
  background: var(--ag-nav-chip) !important;
}

html[data-theme="dark"] .reportes-tab {
  color: var(--color-muted) !important;
}

html[data-theme="dark"] .reportes-tab:hover {
  color: var(--color-text) !important;
  background: rgb(255 255 255 / 6%) !important;
}

html[data-theme="dark"] .reportes-tab.is-active {
  background: var(--ag-nav-surface) !important;
  color: var(--color-text) !important;
  box-shadow: 0 1px 2px rgb(0 0 0 / 35%);
}

html[data-theme="dark"] .frean-main .btn-outline-secondary {
  background: var(--ag-nav-chip) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text) !important;
}

html[data-theme="dark"] .frean-main .btn-outline-primary {
  background: rgba(56, 189, 248, 0.12) !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
  color: #7dd3fc !important;
}

html[data-theme="dark"] .frean-main .btn-outline-success {
  background: rgba(34, 197, 94, 0.12) !important;
  border-color: rgba(34, 197, 94, 0.4) !important;
  color: #86efac !important;
}

html[data-theme="dark"] .reportes-doughnut-stat {
  background: var(--ag-nav-chip) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text);
}

html[data-theme="dark"] .reportes-doughnut-stat.is-off {
  background: var(--color-row-alt) !important;
}

html[data-theme="dark"] .reportes-doughnut-stat-label,
html[data-theme="dark"] .reportes-doughnut-stat-value {
  color: var(--color-text) !important;
}

html[data-theme="dark"] .reportes-doughnut-stat-pct {
  color: var(--color-muted) !important;
}

/* —— Dark: KPIs stock / cards / filas remarcadas —— */
html[data-theme="dark"] .stock-header-kpi,
html[data-theme="dark"] .page-header-actions .stock-header-kpi {
  background: var(--ag-nav-surface) !important;
  border-color: var(--color-border) !important;
  box-shadow: 0 1px 2px rgb(0 0 0 / 35%);
  color: var(--color-text);
}

html[data-theme="dark"] .stock-header-kpi.is-active-filter {
  background: var(--brand-accent-light) !important;
  box-shadow: inset 0 0 0 1.5px var(--frean-accent, #5eb8f0);
}

html[data-theme="dark"] .stock-header-kpi .label {
  color: var(--color-muted);
}

html[data-theme="dark"] .stock-header-kpi .value {
  color: var(--color-text) !important;
}

html[data-theme="dark"] .stock-header-kpi .stock-header-kpi-meta {
  color: var(--color-muted);
}

html[data-theme="dark"] .stock-header-kpi--reservado .label { color: #fb923c; }
html[data-theme="dark"] .stock-header-kpi--disponible .label { color: #4ade80; }
html[data-theme="dark"] .stock-header-kpi--transito .label { color: #38bdf8; }
html[data-theme="dark"] .stock-header-kpi--faltantes .label { color: #f87171; }
html[data-theme="dark"] .stock-header-kpi--facturado .label { color: #c084fc; }
html[data-theme="dark"] .stock-header-kpi--pend-fac .label { color: #fbbf24; }

html[data-theme="dark"] .stat-tile .label {
  color: var(--brand-accent) !important;
}

html[data-theme="dark"] .stat-tile .value {
  color: var(--color-text) !important;
}

html[data-theme="dark"] .frean-main .table tbody tr.stock-row-comprometido,
html[data-theme="dark"] .frean-main .table tbody tr.stock-row-comprometido > td,
html[data-theme="dark"] .frean-main table.dataTable tbody tr.stock-row-comprometido > td,
html[data-theme="dark"] .dataTables_scrollBody tbody tr.stock-row-comprometido > td {
  background-color: rgba(251, 191, 36, 0.14) !important;
  color: var(--color-text) !important;
  border-bottom-color: rgba(251, 191, 36, 0.32) !important;
}

html[data-theme="dark"] .frean-main .table tbody tr.stock-row-comprometido:hover > td,
html[data-theme="dark"] .frean-main table.dataTable tbody tr.stock-row-comprometido:hover > td {
  background-color: rgba(251, 191, 36, 0.22) !important;
}

html[data-theme="dark"] .operacion-ver-sector,
html[data-theme="dark"] .operacion-ver-sector--otros {
  background: var(--ag-nav-chip) !important;
  border-color: var(--color-border) !important;
}

html[data-theme="dark"] .operacion-ver-otros-row {
  border-top-color: var(--color-border);
}

html[data-theme="dark"] .stock-oc-banner {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
}

html[data-theme="dark"] .stock-oc-banner-label {
  color: var(--color-text);
}

html[data-theme="dark"] .productos-table .celda-codigo code {
  background: var(--ag-nav-chip);
  color: var(--color-text);
}

html[data-theme="dark"] .badge-parcial,
html[data-theme="dark"] .cheque-vence-pronto {
  background: rgba(251, 191, 36, 0.16) !important;
  color: #fbbf24 !important;
}

html[data-theme="dark"] .operacion-doc-chip--remito {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}

html[data-theme="dark"] .operacion-doc-chip--remito:hover {
  background: rgba(34, 197, 94, 0.24);
  color: #bbf7d0;
}

html[data-theme="dark"] .operacion-doc-chip--factura {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

html[data-theme="dark"] .operacion-doc-chip--factura:hover {
  background: rgba(56, 189, 248, 0.24);
  color: #bae6fd;
}

html[data-theme="dark"] .frean-main .badge-success {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
}

html[data-theme="dark"] .frean-main .badge-warning {
  background: rgba(251, 191, 36, 0.16);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}

html[data-theme="dark"] .frean-main .badge-info {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
}

html[data-theme="dark"] .frean-main .badge-secondary,
html[data-theme="dark"] .frean-main .badge-light,
html[data-theme="dark"] .frean-main .badge-dark {
  background: var(--ag-nav-chip);
  color: var(--color-muted);
  border-color: var(--color-border);
}

html[data-theme="dark"] .badge-mov-pill.badge-mov-estado-activo,
html[data-theme="dark"] .badge-mov-pill.badge-mov-stock-ok {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}

html[data-theme="dark"] .badge-mov-pill.badge-mov-estado-pendiente,
html[data-theme="dark"] .badge-mov-pill.badge-mov-stock-bajo {
  background: rgba(251, 191, 36, 0.16);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fbbf24;
}

html[data-theme="dark"] .badge-mov-pill.badge-mov-estado-anulado,
html[data-theme="dark"] .badge-mov-pill.badge-mov-stock-cero {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

html[data-theme="dark"] .badge-mov-pill.badge-mov-estado-compensa,
html[data-theme="dark"] .badge-mov-pill.badge-mov-tipo-compra,
html[data-theme="dark"] .badge-mov-pill.badge-mov-tipo-deuda {
  background: rgba(251, 146, 60, 0.16);
  border-color: rgba(251, 146, 60, 0.35);
  color: #fdba74;
}

html[data-theme="dark"] .badge-mov-pill.badge-mov-tipo-ingreso {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

html[data-theme="dark"] .badge-mov-pill.badge-mov-tipo-apertura,
html[data-theme="dark"] .badge-mov-pill.badge-mov-tipo-otro {
  background: var(--ag-nav-chip);
  border-color: var(--color-border);
  color: var(--color-muted);
}

html[data-theme="dark"] .badge-mov-pill.badge-mov-tipo-cierre {
  background: rgba(129, 140, 248, 0.18);
  border-color: rgba(129, 140, 248, 0.35);
  color: #a5b4fc;
}

html[data-theme="dark"] .bom-ver-layout table.table tbody tr.bom-row-short > td,
html[data-theme="dark"] .frean-main .table tbody tr.op-mat-row-short > td {
  color: var(--color-text) !important;
}

html[data-theme="dark"] .btn-table-icon--view {
  background: var(--ag-nav-chip);
  border-color: var(--color-border);
  color: var(--color-muted);
}

html[data-theme="dark"] .btn-table-icon--imputar {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fbbf24;
}

html[data-theme="dark"] .btn-table-icon--danger {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

html[data-theme="dark"] .frean-duplicate-alert {
  background: rgba(251, 191, 36, 0.14);
  border-bottom-color: rgba(251, 191, 36, 0.35);
  color: #fbbf24;
}

.rrhh-huellas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  min-height: calc(1.5em + 0.75rem + 2px);
  padding: 0.4rem 0.65rem;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  background: #fff;
}

html[data-theme="dark"] .rrhh-huellas {
  border-color: var(--color-border, #3a4654);
  background: var(--color-surface, #1f2a37);
}

/* Cotización — flyout como Catálogo / demás módulos */
.ag-sidebar-flyout--cotiz {
  min-width: min(18rem, calc(100vw - 5rem));
  max-width: min(20rem, calc(100vw - var(--ag-nav-current-width) - 12px));
}

.frean-cotiz-flyout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.frean-cotiz-refresh {
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ag-nav-text-muted);
  cursor: pointer;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.frean-cotiz-refresh:hover,
.frean-cotiz-refresh:focus,
.frean-cotiz-refresh:focus-visible {
  color: var(--ag-nav-active-color);
  background: var(--ag-nav-active-bg);
  outline: none;
}

.frean-cotiz-refresh.is-busy i {
  animation: frean-cotiz-spin 0.7s linear infinite;
}

@keyframes frean-cotiz-spin {
  to { transform: rotate(360deg); }
}

.frean-cotiz-block {
  padding: 0 4px 6px;
}

.ag-flyout-group-label {
  padding: 6px 12px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ag-nav-text-muted);
}

.frean-cotiz-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 0.8rem;
  color: var(--ag-nav-text);
}

.frean-cotiz-table th,
.frean-cotiz-table td {
  padding: 0.35rem 0.75rem;
  border: 0;
  font-weight: 500;
}

.frean-cotiz-table th {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ag-nav-text-muted);
}

.frean-cotiz-table .text-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.frean-cotiz-table tbody tr:hover td {
  background: rgba(0, 0, 0, 0.03);
}

html[data-theme="dark"] .frean-cotiz-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.05);
}

.frean-cotiz-code {
  margin-left: 0.2rem;
  color: var(--ag-nav-text-muted);
  font-size: 0.7rem;
}

.frean-cotiz-foot {
  margin: 0.25rem 0.75rem 0.35rem;
  font-size: 0.64rem;
  line-height: 1.3;
  color: var(--ag-nav-text-muted);
}

#frean-dolar-nav-btn[aria-expanded="true"] {
  color: var(--ag-nav-active-color) !important;
  background: var(--ag-nav-active-bg) !important;
}

/* Usuarios — modal dual + árbol de permisos */
.usuario-action-modal .modal-dialog {
  max-width: min(28rem, calc(100vw - 1.5rem));
  width: 100%;
  transition: max-width 0.22s ease;
}
.usuario-action-modal.is-perms-open .modal-dialog {
  max-width: min(56rem, calc(100vw - 1.5rem));
}
/* Scroll solo en la card de permisos; el popup no se mueve */
.usuario-action-modal .modal-body {
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}
.usuario-action-modal #usuario-modal-alert {
  flex: 0 0 auto;
}
.usuario-action-modal .usuario-modal-layout {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.85rem;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}
.usuario-action-modal.is-perms-open .usuario-modal-layout {
  /* Altura explícita: sin esto overflow-y del árbol no scrollea */
  height: min(68vh, 32rem);
  max-height: min(68vh, 32rem);
  overflow: hidden;
}
.usuario-action-modal:not(.is-perms-open) .usuario-modal-layout {
  height: auto;
  max-height: none;
}
.usuario-modal-card {
  flex: 1 1 16rem;
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.015);
}
.usuario-modal-card--datos {
  flex: 1 1 17rem;
  overflow: visible;
  align-self: flex-start;
}
.usuario-action-modal.is-perms-open .usuario-modal-card--datos {
  align-self: stretch;
  overflow: hidden;
}
html[data-theme="dark"] .usuario-modal-card {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}
.usuario-modal-card--perms {
  flex: 1 1 20rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  padding-bottom: 0.55rem;
}
.usuario-modal-card--perms .usuario-modal-perms-head,
.usuario-modal-card--perms > .text-muted {
  flex: 0 0 auto;
}
.usuario-modal-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ag-nav-text-muted, #6c757d);
  margin-bottom: 0.65rem;
}
.usuario-modal-perms-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.usuario-modal-footer {
  flex-wrap: wrap;
}
.usuario-modal-footer-spacer {
  flex: 1 1 auto;
  min-width: 0.5rem;
}
#usr-modal-perms-btn.is-active {
  color: #0d6efd;
  border-color: rgba(13, 110, 253, 0.45);
  background: rgba(13, 110, 253, 0.08);
}

.usuario-perm-tree {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 0.25rem;
  margin: 0 -0.1rem 0 0;
}
.usuario-perm-mod {
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 10px;
  background: #fff;
  flex: 0 0 auto;
}
html[data-theme="dark"] .usuario-perm-mod {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}
.usuario-perm-mod-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.45rem 0.55rem 0.45rem 0.65rem;
}
.usuario-perm-mod-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.usuario-perm-mod-label i {
  width: 1.1rem;
  text-align: center;
  opacity: 0.75;
  font-size: 0.85rem;
}
.usuario-perm-toggle {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #64748b;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.usuario-perm-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #0f172a;
}
.usuario-perm-toggle i {
  transition: transform 0.18s ease;
  font-size: 0.75rem;
}
.usuario-perm-toggle.is-open i {
  transform: rotate(180deg);
}
.usuario-perm-subs {
  padding: 0.15rem 0.55rem 0.55rem 1.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}
html[data-theme="dark"] .usuario-perm-subs {
  border-top-color: rgba(255, 255, 255, 0.06);
}
.usuario-perm-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
  flex: 1;
  min-width: 0;
}
.usuario-perm-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.usuario-perm-check-ui {
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 4px;
  border: 1.5px solid #94a3b8;
  background: #fff;
  flex-shrink: 0;
  position: relative;
}
html[data-theme="dark"] .usuario-perm-check-ui {
  background: #1e293b;
  border-color: #64748b;
}
.usuario-perm-check input:checked + .usuario-perm-check-ui {
  background: #0d6efd;
  border-color: #0d6efd;
}
.usuario-perm-check input:checked + .usuario-perm-check-ui::after {
  content: '';
  position: absolute;
  left: 0.28rem;
  top: 0.06rem;
  width: 0.28rem;
  height: 0.52rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.usuario-perm-check input:indeterminate + .usuario-perm-check-ui {
  background: #0d6efd;
  border-color: #0d6efd;
}
.usuario-perm-check input:indeterminate + .usuario-perm-check-ui::after {
  content: '';
  position: absolute;
  left: 0.2rem;
  top: 0.4rem;
  width: 0.55rem;
  height: 0;
  border-top: 2px solid #fff;
}
.usuario-perm-check--sub {
  padding: 0.28rem 0.2rem;
  font-size: 0.875rem;
}

/* Empleados — modal más ancho + campos clave + scroll de horarios */
.empleado-action-modal.stock-action-modal .modal-dialog {
  max-width: min(64rem, calc(100vw - 1.5rem));
  width: 100%;
  max-height: calc(100dvh - 1.5rem);
}
.empleado-action-modal .empleado-horario-builder #emp-horario-table-wrap {
  max-height: min(14rem, 28vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
}

.empleado-liquidar-modal.stock-action-modal .modal-dialog {
  max-width: min(36rem, calc(100vw - 1.5rem));
}

.eliq-pago-add {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr) auto;
  gap: 0.45rem 0.65rem;
  align-items: end;
  margin-top: 0.75rem;
}

.eliq-pago-add .form-group {
  margin-bottom: 0;
}

.eliq-pago-add label {
  font-size: 0.72rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.2rem;
}

.eliq-pago-add .form-control {
  height: calc(1.4em + 0.7rem + 2px);
  padding: 0.35rem 0.55rem;
  font-size: 0.9rem;
}

.eliq-pago-add .eliq-pago-add-btn {
  height: calc(1.4em + 0.7rem + 2px);
  padding: 0 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 10px;
}

.eliq-pagos-wrap {
  margin-top: 0.65rem;
}

.liq-formas {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

@media (max-width: 575.98px) {
  .eliq-pago-add {
    grid-template-columns: 1fr 1fr;
  }

  .eliq-pago-add .eliq-pago-add-btn {
    grid-column: 1 / -1;
  }
}

/* Cliente — ajustes por ficha + panel en venta/cobro */
.cliente-ajustes-editor {
  min-height: 1.5rem;
}
.cliente-ajustes-table-wrap {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.cliente-ajustes-table {
  margin: 0;
  font-size: 0.84rem;
}
.cliente-ajustes-table thead th {
  background: #f8fafc;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.45rem 0.65rem;
  white-space: nowrap;
}
.cliente-ajustes-table tbody td,
.cliente-ajustes-table tfoot td {
  vertical-align: middle;
  padding: 0.4rem 0.65rem;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  color: #334155;
}
.cliente-ajustes-table__empty td {
  padding: 0.55rem 0.65rem;
}
.cliente-ajustes-table__accion {
  width: 2.5rem;
  text-align: center;
  padding-left: 0.25rem !important;
  padding-right: 0.35rem !important;
}
.cliente-ajustes-table__rm {
  color: #94a3b8 !important;
  padding: 0.15rem 0.35rem !important;
  line-height: 1;
}
.cliente-ajustes-table__rm:hover {
  color: #dc2626 !important;
}
.cliente-ajustes-table__add td {
  background: #fbfdff;
}
.cliente-ajustes-table__add .form-control,
.cliente-ajustes-table__add .premium-input {
  height: calc(1.4em + 0.45rem + 2px) !important;
  padding: 0.2rem 0.4rem !important;
  font-size: 0.8rem !important;
}
.cliente-ajustes-table__add .btn {
  min-width: 2rem;
  padding: 0.2rem 0.45rem;
}
html[data-theme="dark"] .cliente-ajustes-table-wrap {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
}
html[data-theme="dark"] .cliente-ajustes-table thead th {
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
}
html[data-theme="dark"] .cliente-ajustes-table__add td {
  background: rgba(255, 255, 255, 0.03);
}
.cliente-iva-compra-row {
  display: grid;
  grid-template-columns: 1fr minmax(5.5rem, 7rem);
  gap: 0.5rem;
}
.cliente-ajustes-panel {
  flex: 0 0 auto;
  margin: 0;
  min-height: 0;
  max-height: 9.5rem;
}
.cliente-ajustes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  align-items: stretch;
  min-height: 0;
  height: 100%;
}
.cliente-ajustes-panel--solo .cliente-ajustes-grid {
  grid-template-columns: 1fr;
}
.cliente-ajustes-panel--duo-obs .cliente-ajustes-grid,
.cliente-ajustes-panel--duo-iva .cliente-ajustes-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.cliente-ajustes-panel--trio .cliente-ajustes-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.cliente-ajustes-card {
  margin: 0 !important;
  min-width: 0;
  min-height: 0;
  max-height: 9.5rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.45rem 0.6rem !important;
}
.cliente-ajustes-card__title {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.cliente-ajustes-check-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin-bottom: 0.25rem;
}
.cliente-ajustes-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.25rem 0.4rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 7px;
  background: #f8fafc;
  font-size: 0.8rem;
  color: #334155;
  cursor: pointer;
  font-weight: 500;
}
.cliente-ajustes-check:hover {
  border-color: rgba(70, 173, 237, 0.35);
  background: #f0f9ff;
}
.cliente-ajustes-check input[type="checkbox"] {
  margin: 0;
  flex: 0 0 auto;
}
.cliente-ajustes-check__text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cliente-ajustes-empty {
  font-size: 0.75rem;
  padding: 0.1rem 0;
}
.cliente-ajustes-nuevo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.15rem;
  flex: 0 0 auto;
}
.cliente-ajustes-nuevo .form-control,
.cliente-ajustes-nuevo .premium-input {
  width: auto;
  min-width: 4.8rem;
  max-width: 7rem;
  height: calc(1.4em + 0.35rem + 2px) !important;
  padding: 0.15rem 0.35rem !important;
  font-size: 0.78rem !important;
}
.cliente-ajustes-nuevo #cli-aj-valor {
  max-width: 4.5rem;
  min-width: 3.5rem;
}
.cliente-ajustes-add-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 0;
  background: transparent;
  color: #359cd9;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.15rem 0;
  cursor: pointer;
  flex: 0 0 auto;
  align-self: flex-start;
}
.cliente-ajustes-add-trigger:hover {
  color: #1d7eb8;
  text-decoration: underline;
}
.cliente-ajustes-add-trigger .fa-plus {
  font-size: 0.7rem;
}
.cliente-ajustes-save {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: #64748b;
  white-space: nowrap;
  margin: 0;
  cursor: pointer;
}
.cliente-ajustes-save input[type="checkbox"] {
  margin: 0;
}
.cliente-ajustes-info {
  border: 0;
  background: transparent;
  color: #94a3b8;
  padding: 0;
  line-height: 1;
  cursor: help;
  font-size: 0.78rem;
}
.cliente-ajustes-info:hover {
  color: #359cd9;
}
html[data-theme="dark"] .cliente-ajustes-check {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}
html[data-theme="dark"] .cliente-ajustes-check:hover {
  background: rgba(70, 173, 237, 0.12);
}
.cliente-ajustes-iva {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.cliente-ajustes-iva .form-control,
.cliente-ajustes-iva .premium-input {
  width: auto;
  min-width: 7rem;
  max-width: 100%;
  flex: 1 1 7rem;
  height: calc(1.4em + 0.35rem + 2px) !important;
  padding: 0.15rem 0.4rem !important;
  font-size: 0.78rem !important;
}
.cliente-ajustes-iva #cli-aj-iva-manual {
  max-width: 4.25rem;
  min-width: 3.25rem;
  flex: 0 0 auto;
}
.cliente-ajustes-obs {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #334155;
  white-space: pre-wrap;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}
html[data-theme="dark"] .cliente-ajustes-obs {
  color: #e2e8f0;
}
@media (max-width: 900px) {
  .cliente-ajustes-panel {
    max-height: none;
  }
  .cliente-ajustes-grid,
  .cliente-ajustes-panel--solo .cliente-ajustes-grid,
  .cliente-ajustes-panel--duo-obs .cliente-ajustes-grid,
  .cliente-ajustes-panel--duo-iva .cliente-ajustes-grid,
  .cliente-ajustes-panel--trio .cliente-ajustes-grid {
    grid-template-columns: 1fr;
  }
  .cliente-ajustes-card {
    max-height: 8rem;
  }
}
.cliente-ajustes-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px dashed rgba(15, 23, 42, 0.08);
}
.cliente-ajustes-add .form-control,
.cliente-ajustes-add .premium-input {
  width: auto;
  min-width: 5.5rem;
  max-width: 8rem;
  height: calc(1.5em + 0.4rem + 2px) !important;
  padding: 0.2rem 0.45rem !important;
  font-size: 0.8rem !important;
}
.cliente-ajustes-add #cli-aj-valor {
  max-width: 5rem;
}
.cliente-ajustes-save {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
}
html[data-theme="dark"] .cliente-ajustes-chip {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.12);
}
html[data-theme="dark"] .cliente-ajustes-chip__modo {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}
.stock-action-modal .maestro-field--key > label,
.empleado-action-modal .maestro-field--key > label {
  color: #0f172a;
  font-weight: 750;
}
html[data-theme="dark"] .stock-action-modal .maestro-field--key > label,
html[data-theme="dark"] .empleado-action-modal .maestro-field--key > label {
  color: #f1f5f9;
}
.stock-action-modal .maestro-field--key .premium-input,
.stock-action-modal .maestro-field--key .form-control,
.empleado-action-modal .maestro-field--key .premium-input,
.empleado-action-modal .maestro-field--key .form-control {
  border-color: rgba(13, 110, 253, 0.45);
  background: rgba(13, 110, 253, 0.04);
  font-weight: 600;
}
html[data-theme="dark"] .stock-action-modal .maestro-field--key .premium-input,
html[data-theme="dark"] .stock-action-modal .maestro-field--key .form-control,
html[data-theme="dark"] .empleado-action-modal .maestro-field--key .premium-input,
html[data-theme="dark"] .empleado-action-modal .maestro-field--key .form-control {
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(96, 165, 250, 0.08);
}
.stock-action-modal .maestro-field--key .premium-input:focus,
.empleado-action-modal .maestro-field--key .premium-input:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.18);
}
@media (max-width: 767.98px) {
  .usuario-action-modal.is-perms-open .usuario-modal-layout {
    flex-wrap: wrap;
    height: auto;
    max-height: min(78vh, 40rem);
  }
  .usuario-action-modal.is-perms-open .modal-body {
    overflow: hidden !important;
  }
  .usuario-action-modal.is-perms-open .usuario-modal-card--datos {
    align-self: flex-start;
    flex: 1 1 100%;
  }
  .usuario-modal-card--perms {
    flex: 1 1 100%;
    height: min(48vh, 22rem);
    max-height: min(48vh, 22rem);
  }
}
