/*
 * Encabezado canónico del ERP.
 *
 * Proveedores define el patrón visual. Los selectores de compatibilidad
 * permiten aplicarlo a los módulos modernizados y a las vistas heredadas
 * sin alterar sus permisos, acciones ni flujos particulares.
 */
:root {
  --erp-hero-bg: linear-gradient(135deg, #172554 0%, #1e3a5f 100%);
  --erp-hero-ink: #fff;
  --erp-hero-muted: #dbe8f7;
  --erp-hero-eyebrow: #bfcee2;
  --erp-hero-radius: 18px;
  --erp-hero-shadow: 0 10px 26px rgba(15, 23, 42, .12);
}

.erp-page-hero,
header.header.bg-ui-general,
.supplier-workspace .supplier-hero,
.payables-workspace .payables-hero,
.receivables-workspace .receivables-hero,
.treasury-workspace .treasury-hero,
.reports-workspace .reports-hero,
.inventory-form-workspace .inventory-form-hero,
.invoice-workspace .invoice-page-header,
.sales-quotes-page .quote-hero,
.fulfillment-page .fulfillment-hero,
.cash-page .cash-hero {
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-width: 0;
  min-height: 160px;
  margin-bottom: 18px;
  padding: 24px 28px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--erp-hero-radius);
  background: var(--erp-hero-bg);
  box-shadow: var(--erp-hero-shadow);
  color: var(--erp-hero-ink);
}

/* Las cabeceras heredadas viven fuera del contenedor con padding del módulo. */
header.header.bg-ui-general {
  width: auto;
  margin: 20px 24px 18px;
}

.erp-page-hero.erp-competitive-header {
  margin: 20px 24px 18px;
}

.invoice-workspace .invoice-page-header {
  margin: 20px 22px 18px;
}

header.header.bg-ui-general > .container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/*
 * La plantilla anterior agrega 50 px verticales a .header-info y 16 px al
 * texto secundario. Neutralizarlos evita cabeceras de más de 300 px.
 */
header.header.bg-ui-general .header-info {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 110px;
  margin: 0;
  padding: 0;
}

header.header.bg-ui-general .header-title {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 320px 0 0;
}

.erp-page-hero > :first-child,
.supplier-workspace .supplier-hero > :first-child,
.payables-workspace .payables-hero > :first-child,
.receivables-workspace .receivables-hero > :first-child,
.treasury-workspace .treasury-hero > :first-child,
.reports-workspace .reports-hero > :first-child,
.inventory-form-workspace .inventory-form-hero > :first-child,
.invoice-workspace .invoice-page-header > :first-child,
.sales-quotes-page .quote-hero > :first-child,
.fulfillment-page .fulfillment-hero > :first-child,
.cash-page .cash-hero > :first-child {
  flex: 1 1 480px;
  min-width: 0;
}

.erp-page-hero h1,
header.header.bg-ui-general .header-title,
.supplier-workspace .supplier-hero h1,
.payables-workspace .payables-hero h1,
.receivables-workspace .receivables-hero h1,
.treasury-workspace .treasury-hero h1,
.reports-workspace .reports-hero h1,
.inventory-form-workspace .inventory-form-hero h1,
.invoice-workspace .invoice-page-header h1,
.sales-quotes-page .quote-hero h1,
.fulfillment-page .fulfillment-hero h1,
.cash-page .cash-hero h1 {
  max-width: 100%;
  margin: 2px 0 6px;
  color: var(--erp-hero-ink) !important;
  font-size: clamp(25px, 3vw, 36px);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

header.header.bg-ui-general .header-title > strong {
  display: inline;
  color: var(--erp-hero-ink) !important;
}

.erp-page-hero p,
header.header.bg-ui-general .header-title small,
.supplier-workspace .supplier-hero p,
.payables-workspace .payables-hero p,
.receivables-workspace .receivables-hero p,
.treasury-workspace .treasury-hero p,
.reports-workspace .reports-hero p,
.inventory-form-workspace .inventory-form-hero p,
.invoice-workspace .invoice-page-header p,
.sales-quotes-page .quote-hero p,
.fulfillment-page .fulfillment-hero p,
.cash-page .cash-hero p {
  display: block;
  max-width: 900px;
  margin: 0;
  color: var(--erp-hero-muted) !important;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

header.header.bg-ui-general .header-title small {
  margin-top: 6px;
  padding-top: 0;
}

.erp-page-hero__eyebrow,
.supplier-workspace .supplier-hero .supplier-eyebrow,
.payables-workspace .payables-hero .payables-eyebrow,
.receivables-workspace .receivables-hero .receivables-eyebrow,
.treasury-workspace .treasury-hero .treasury-eyebrow,
.reports-workspace .reports-hero .reports-eyebrow,
.inventory-form-workspace .inventory-form-hero .inventory-form-eyebrow,
.invoice-workspace .invoice-page-header .invoice-eyebrow,
.cash-page .cash-hero .cash-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--erp-hero-eyebrow) !important;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  line-height: 1.35;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.erp-page-hero__actions,
.supplier-workspace .supplier-hero-actions,
.payables-workspace .payables-hero-actions,
.receivables-workspace .receivables-hero-actions,
.treasury-workspace .treasury-hero-actions,
.reports-workspace .reports-hero-actions,
.invoice-workspace .invoice-page-header .invoice-panel-actions,
.sales-quotes-page .quote-hero .quote-actions,
.fulfillment-page .fulfillment-hero .fulfillment-actions,
.cash-page .cash-hero .cash-hero-actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

/* Botón canónico dentro del hero: alto contraste sobre el fondo azul. */
.erp-page-hero .btn,
header.header.bg-ui-general .btn,
.supplier-workspace .supplier-hero .supplier-action,
.payables-workspace .payables-hero .payables-action,
.receivables-workspace .receivables-hero .receivables-action,
.treasury-workspace .treasury-hero .treasury-action,
.reports-workspace .reports-hero .btn,
.invoice-workspace .invoice-page-header .invoice-action,
.sales-quotes-page .quote-hero .btn,
.fulfillment-page .fulfillment-hero .btn,
.cash-page .cash-hero .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  max-width: 100%;
  padding: 9px 14px;
  border: 1px solid #fff;
  border-radius: 9px;
  background: #fff !important;
  background-color: #fff !important;
  border-color: #fff !important;
  color: #172554 !important;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: none;
}

.erp-page-hero .btn:hover,
.erp-page-hero .btn:focus,
header.header.bg-ui-general .btn:hover,
header.header.bg-ui-general .btn:focus,
.supplier-workspace .supplier-hero .supplier-action:hover,
.supplier-workspace .supplier-hero .supplier-action:focus,
.payables-workspace .payables-hero .payables-action:hover,
.payables-workspace .payables-hero .payables-action:focus,
.receivables-workspace .receivables-hero .receivables-action:hover,
.receivables-workspace .receivables-hero .receivables-action:focus,
.treasury-workspace .treasury-hero .treasury-action:hover,
.treasury-workspace .treasury-hero .treasury-action:focus,
.reports-workspace .reports-hero .btn:hover,
.reports-workspace .reports-hero .btn:focus,
.invoice-workspace .invoice-page-header .invoice-action:hover,
.invoice-workspace .invoice-page-header .invoice-action:focus,
.sales-quotes-page .quote-hero .btn:hover,
.sales-quotes-page .quote-hero .btn:focus,
.fulfillment-page .fulfillment-hero .btn:hover,
.fulfillment-page .fulfillment-hero .btn:focus,
.cash-page .cash-hero .btn:hover,
.cash-page .cash-hero .btn:focus {
  border-color: #dbe8f7;
  background: #edf4fb !important;
  background-color: #edf4fb !important;
  color: #0f1d45 !important;
  text-decoration: none;
}

/*
 * Contrato final del botón de cabecera. Se incluye el tema en la
 * especificidad para vencer las variantes Bootstrap (.btn-primary,
 * .btn-success, etc.) sin cambiar esos botones fuera del hero.
 */
body.theme-light :is(
  .erp-page-hero,
  header.header.bg-ui-general,
  .supplier-hero,
  .payables-hero,
  .receivables-hero,
  .treasury-hero,
  .reports-hero,
  .inventory-form-hero,
  .invoice-page-header,
  .quote-hero,
  .fulfillment-hero,
  .cash-hero
) :is(.btn, .supplier-action, .payables-action, .receivables-action, .treasury-action, .invoice-action),
body.theme-dark :is(
  .erp-page-hero,
  header.header.bg-ui-general,
  .supplier-hero,
  .payables-hero,
  .receivables-hero,
  .treasury-hero,
  .reports-hero,
  .inventory-form-hero,
  .invoice-page-header,
  .quote-hero,
  .fulfillment-hero,
  .cash-hero
) :is(.btn, .supplier-action, .payables-action, .receivables-action, .treasury-action, .invoice-action) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  min-height: 40px !important;
  height: auto;
  max-width: 100%;
  padding: 9px 14px !important;
  border: 1px solid #fff !important;
  border-radius: 9px !important;
  background: #fff !important;
  background-color: #fff !important;
  color: #172554 !important;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 14px !important;
  font-weight: 750 !important;
  line-height: 1.25 !important;
  text-align: center !important;
  text-decoration: none !important;
  white-space: normal !important;
  box-shadow: none !important;
}

body.theme-light :is(
  .erp-page-hero,
  header.header.bg-ui-general,
  .supplier-hero,
  .payables-hero,
  .receivables-hero,
  .treasury-hero,
  .reports-hero,
  .inventory-form-hero,
  .invoice-page-header,
  .quote-hero,
  .fulfillment-hero,
  .cash-hero
) :is(.btn, .supplier-action, .payables-action, .receivables-action, .treasury-action, .invoice-action):is(:hover, :focus),
body.theme-dark :is(
  .erp-page-hero,
  header.header.bg-ui-general,
  .supplier-hero,
  .payables-hero,
  .receivables-hero,
  .treasury-hero,
  .reports-hero,
  .inventory-form-hero,
  .invoice-page-header,
  .quote-hero,
  .fulfillment-hero,
  .cash-hero
) :is(.btn, .supplier-action, .payables-action, .receivables-action, .treasury-action, .invoice-action):is(:hover, :focus) {
  border-color: #dbe8f7 !important;
  background: #edf4fb !important;
  background-color: #edf4fb !important;
  color: #0f1d45 !important;
}

header.header.bg-ui-general .header-title > p {
  position: absolute;
  top: 50%;
  right: 0;
  display: flex;
  margin: 0 !important;
  transform: translateY(-50%);
}

header.header.bg-ui-general .header-title > p:nth-of-type(2) {
  right: 150px;
}

header.header.bg-ui-general .header-info > p {
  position: absolute;
  top: 50%;
  right: 0;
  display: flex;
  margin: 0 !important;
  transform: translateY(-50%);
}

body.theme-dark header.header.bg-ui-general,
body.theme-dark .erp-page-hero,
body.theme-dark .supplier-workspace .supplier-hero,
body.theme-dark .payables-workspace .payables-hero,
body.theme-dark .receivables-workspace .receivables-hero,
body.theme-dark .treasury-workspace .treasury-hero,
body.theme-dark .reports-workspace .reports-hero,
body.theme-dark .inventory-form-workspace .inventory-form-hero,
body.theme-dark .invoice-workspace .invoice-page-header,
body.theme-dark .sales-quotes-page .quote-hero,
body.theme-dark .fulfillment-page .fulfillment-hero,
body.theme-dark .cash-page .cash-hero {
  background: var(--erp-hero-bg);
  color: var(--erp-hero-ink);
}

@media (max-width: 767px) {
  .erp-page-hero,
  header.header.bg-ui-general,
  .supplier-workspace .supplier-hero,
  .payables-workspace .payables-hero,
  .receivables-workspace .receivables-hero,
  .treasury-workspace .treasury-hero,
  .reports-workspace .reports-hero,
  .inventory-form-workspace .inventory-form-hero,
  .invoice-workspace .invoice-page-header,
  .sales-quotes-page .quote-hero,
  .fulfillment-page .fulfillment-hero,
  .cash-page .cash-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
    padding: 18px;
    border-radius: 14px;
  }

  header.header.bg-ui-general {
    margin: 16px 15px;
    min-height: 0;
  }

  .erp-page-hero.erp-competitive-header,
  .invoice-workspace .invoice-page-header {
    margin: 16px 15px;
  }

  .erp-page-hero__actions,
  .supplier-workspace .supplier-hero-actions,
  .payables-workspace .payables-hero-actions,
  .receivables-workspace .receivables-hero-actions,
  .treasury-workspace .treasury-hero-actions,
  .reports-workspace .reports-hero-actions,
  .invoice-workspace .invoice-page-header .invoice-panel-actions,
  .sales-quotes-page .quote-hero .quote-actions,
  .fulfillment-page .fulfillment-hero .fulfillment-actions,
  .cash-page .cash-hero .cash-hero-actions {
    width: 100%;
    justify-content: flex-start;
  }

  header.header.bg-ui-general .header-info {
    display: block;
    min-height: 0;
  }

  header.header.bg-ui-general .header-title {
    padding-right: 0;
  }

  header.header.bg-ui-general .header-title > p,
  header.header.bg-ui-general .header-title > p:nth-of-type(2),
  header.header.bg-ui-general .header-info > p {
    position: static;
    display: flex;
    margin-top: 12px !important;
    transform: none;
  }

  .erp-page-hero__actions .btn,
  .supplier-workspace .supplier-hero-actions .supplier-action,
  .payables-workspace .payables-hero-actions .payables-action,
  .receivables-workspace .receivables-hero-actions .receivables-action,
  .treasury-workspace .treasury-hero-actions .treasury-action,
  .reports-workspace .reports-hero-actions .btn,
  .invoice-workspace .invoice-page-header .invoice-panel-actions .invoice-action,
  .sales-quotes-page .quote-hero .quote-actions .btn,
  .fulfillment-page .fulfillment-hero .fulfillment-actions .btn,
  .cash-page .cash-hero .cash-hero-actions .btn {
    flex: 1 1 180px;
  }
}

@media print {
  .erp-page-hero,
  header.header.bg-ui-general,
  .supplier-workspace .supplier-hero,
  .payables-workspace .payables-hero,
  .receivables-workspace .receivables-hero,
  .treasury-workspace .treasury-hero,
  .reports-workspace .reports-hero,
  .inventory-form-workspace .inventory-form-hero,
  .invoice-workspace .invoice-page-header,
  .sales-quotes-page .quote-hero,
  .fulfillment-page .fulfillment-hero,
  .cash-page .cash-hero {
    border: 1px solid #cbd5e1;
    background: #fff !important;
    box-shadow: none;
    color: #0f172a !important;
  }

  .erp-page-hero h1,
  header.header.bg-ui-general .header-title,
  .supplier-workspace .supplier-hero h1,
  .payables-workspace .payables-hero h1,
  .receivables-workspace .receivables-hero h1,
  .treasury-workspace .treasury-hero h1,
  .reports-workspace .reports-hero h1,
  .inventory-form-workspace .inventory-form-hero h1,
  .invoice-workspace .invoice-page-header h1,
  .sales-quotes-page .quote-hero h1,
  .fulfillment-page .fulfillment-hero h1,
  .cash-page .cash-hero h1,
  .erp-page-hero p,
  header.header.bg-ui-general .header-title small {
    color: #0f172a !important;
  }
}
