/*
 * AquaControl V79.11 · Piloto visual Productos + Nueva Venta
 * Alcance estrictamente visual. Conserva IDs, data-*, eventos y reglas de negocio.
 */

:root {
  --pilot-navy-950: #081b2c;
  --pilot-navy-800: #123a5a;
  --pilot-primary-700: #0b5cab;
  --pilot-primary-800: #084884;
  --pilot-aqua-700: #087f8c;
  --pilot-surface: #ffffff;
  --pilot-surface-subtle: #f8fafc;
  --pilot-border: #cbd5e1;
  --pilot-text: #172b3a;
  --pilot-muted: #475569;
  --pilot-danger: #b42318;
  --pilot-focus: #ffbf47;
}

.corporate-theme .enterprise-pilot-view {
  color: var(--pilot-text);
}

.corporate-theme .enterprise-page-header {
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 20px;
  padding: 3px 0 16px;
  border-bottom: 1px solid #dbe4ed;
}

.corporate-theme .enterprise-page-header h3 {
  margin: 3px 0 5px;
  color: var(--pilot-navy-950);
  font-size: 1.65rem;
  line-height: 1.2;
}

.corporate-theme .enterprise-page-header p {
  max-width: 760px;
  color: var(--pilot-muted);
  font-size: .9rem;
  line-height: 1.5;
}

.enterprise-eyebrow {
  display: block;
  color: var(--pilot-primary-700);
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .095em;
}

.enterprise-count {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #c8d8e8;
  border-radius: 999px;
  color: #29465f;
  background: #f1f6fa;
  font-size: .76rem;
  font-weight: 750;
  white-space: nowrap;
}

/* Nueva venta */

.corporate-theme #saleView .sale-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.corporate-theme #saleView .sale-header-actions button {
  min-height: 38px;
  padding-inline: 14px;
  font-size: .82rem;
}

.corporate-theme #saleView .sale-grid {
  grid-template-columns: minmax(520px, 1fr) minmax(380px, 420px);
  gap: 16px;
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  align-items: start;
}

.corporate-theme #saleView {
  height: auto;
  min-height: 100%;
  overflow: visible;
}

.corporate-theme #saleView .product-panel,
.corporate-theme #saleView .cart-panel {
  border: 1px solid #d6e0e9;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 3px 12px rgba(8, 27, 44, .07);
}

.sale-panel-heading,
.product-table-intro,
.product-form-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.sale-panel-heading {
  margin-bottom: 13px;
}

.sale-panel-heading h4,
.product-table-intro h4,
.product-form-heading h4 {
  margin: 3px 0 0;
  color: var(--pilot-navy-950);
  font-size: 1.05rem;
}

.corporate-theme #saleView .search-row {
  position: sticky;
  top: -16px;
  z-index: 3;
  margin: 0 -2px 14px;
  padding: 2px 2px 12px;
  background: var(--pilot-surface);
}

.enterprise-search-label {
  display: block;
  margin-bottom: 6px;
  color: #344a5e;
  font-size: .78rem;
  font-weight: 700;
}

.corporate-theme #saleView #productSearch {
  min-height: 44px;
  border: 1px solid #aebfce;
  border-radius: 8px;
  padding: 10px 13px;
  color: var(--pilot-text);
  background: #fff;
  font-size: .9rem;
}

.corporate-theme #saleView #productSearch::placeholder {
  color: #64748b;
  opacity: 1;
}

.corporate-theme #saleView #productSearch:focus {
  border-color: var(--pilot-primary-700);
  outline: 3px solid var(--pilot-focus);
  outline-offset: 1px;
  box-shadow: none;
}

.corporate-theme #saleView .product-buttons {
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
}

.corporate-theme #saleView .product-btn {
  min-height: 108px;
  gap: 4px;
  padding: 12px;
  border: 1px solid #cdd9e4;
  border-radius: 9px;
  color: var(--pilot-text);
  background: #fff;
  box-shadow: 0 1px 3px rgba(8, 27, 44, .06);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.corporate-theme #saleView .product-btn:hover {
  border-color: var(--pilot-primary-700);
  background: #f6faff;
  box-shadow: 0 5px 14px rgba(11, 92, 171, .13);
  transform: translateY(-1px);
}

.corporate-theme #saleView .product-btn:active {
  transform: translateY(0);
}

.corporate-theme #saleView .product-btn:focus-visible {
  outline: 3px solid var(--pilot-focus) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 2px #7a4b00 !important;
}

.corporate-theme #saleView .product-btn strong {
  color: var(--pilot-navy-950);
  font-size: .91rem;
  line-height: 1.3;
}

.corporate-theme #saleView .product-btn span {
  margin-top: auto;
  color: var(--pilot-primary-700);
  font-size: 1.08rem;
  font-weight: 800;
}

.corporate-theme #saleView .product-btn small {
  color: var(--pilot-muted);
  font-size: .75rem;
  line-height: 1.3;
}

.corporate-theme #saleView .cart-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
}

.corporate-theme #saleView .sale-scroll-panel {
  max-height: none;
  overflow: visible;
}

.corporate-theme #saleView .product-buttons {
  max-height: clamp(260px, 48dvh, 560px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
  scrollbar-gutter: stable;
}

.corporate-theme #saleView .cart-panel-heading,
.corporate-theme #saleView .cart-panel > .small-label,
.corporate-theme #saleView .cart-panel > .customer-mini-card {
  flex: 0 0 auto;
}

.corporate-theme #saleView .cart-panel-heading {
  margin-bottom: 0;
}

.corporate-theme #saleView .cart-table-wrap {
  flex: 0 0 auto;
  height: clamp(180px, 32dvh, 360px);
  min-height: 180px;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #d6e0e9;
  border-radius: 8px;
  background: var(--pilot-surface-subtle);
  scrollbar-gutter: stable;
}

.corporate-theme #saleView .product-buttons,
.corporate-theme #saleView .cart-table-wrap {
  scrollbar-width: auto;
  scrollbar-color: #6f8fab #edf2f6;
}

.corporate-theme #saleView .product-buttons::-webkit-scrollbar,
.corporate-theme #saleView .cart-table-wrap::-webkit-scrollbar {
  width: 12px;
}

.corporate-theme #saleView .product-buttons::-webkit-scrollbar-thumb,
.corporate-theme #saleView .cart-table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid #edf2f6;
  border-radius: 999px;
  background: #6f8fab;
}

.corporate-theme #saleView .cart-detail-list {
  gap: 8px;
}

.corporate-theme #saleView .cart-detail-item {
  grid-template-columns: minmax(140px, 1fr) auto;
  gap: 10px 12px;
  padding: 11px;
  border: 1px solid #dce4eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

.corporate-theme #saleView .cart-detail-qty,
.corporate-theme #saleView .cart-detail-subtotal,
.corporate-theme #saleView .cart-remove-btn {
  align-self: center;
}

.corporate-theme #saleView .cart-detail-subtotal {
  grid-column: 1;
}

.corporate-theme #saleView .cart-remove-btn {
  grid-column: 2;
  grid-row: 2;
}

.corporate-theme #saleView .qty-cell button {
  min-width: 32px;
  min-height: 32px;
  border: 1px solid #b9c9d8;
  border-radius: 6px;
  background: #f4f7fa;
  color: var(--pilot-navy-800);
}

.corporate-theme #saleView .compact-total-row {
  flex: 0 0 64px;
  width: 100%;
  min-height: 64px;
  max-height: 64px;
  margin-top: 0;
  padding: 13px 14px;
  border: 1px solid #b9cde0;
  border-radius: 8px;
  color: var(--pilot-navy-950);
  background: #edf5fb;
  font-size: 1rem;
}

.corporate-theme #saleView .compact-total-row strong {
  color: var(--pilot-primary-700);
  font-size: 1.55rem;
  line-height: 1;
}

.corporate-theme #saleView #chargeSaleBtn {
  flex: 0 0 48px;
  min-height: 48px;
  max-height: 48px;
  border-radius: 8px;
  background: var(--pilot-primary-700);
  box-shadow: 0 5px 12px rgba(11, 92, 171, .18);
  font-size: .98rem;
}

.corporate-theme #saleView #chargeSaleBtn:hover {
  background: var(--pilot-primary-800);
}

.corporate-theme #saleView #chargeSaleBtn:disabled {
  border-color: #cbd5e1;
  color: #64748b;
  background: #e2e8f0;
  box-shadow: none;
  cursor: not-allowed;
}

.empty-cart-message {
  display: grid;
  place-items: center;
  min-height: 126px;
  padding: 18px;
  text-align: center;
  color: var(--pilot-muted);
  font-size: .84rem;
}

/* Productos */

.corporate-theme #productsView .enterprise-product-form {
  display: grid;
  grid-template-columns: minmax(320px, 5fr) minmax(150px, 2fr) minmax(220px, 3fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid #d6e0e9;
  border-radius: 10px;
  box-shadow: 0 3px 12px rgba(8, 27, 44, .06);
}

.corporate-theme #productsView .product-form-heading {
  grid-column: 1 / -1;
  align-items: center;
  padding-bottom: 13px;
  border-bottom: 1px solid #e2e8f0;
}

.corporate-theme #productsView .product-form-heading p,
.corporate-theme #productsView .product-table-intro p {
  margin: 0;
  color: var(--pilot-muted);
  font-size: .78rem;
}

.corporate-theme #productsView .product-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.corporate-theme #productsView .product-field > span {
  color: #344a5e;
  font-size: .79rem;
  font-weight: 700;
}

.corporate-theme #productsView .product-field input {
  min-height: 42px;
  border: 1px solid #aebfce;
  border-radius: 7px;
  color: var(--pilot-text);
  background: #fff;
  font-size: .88rem;
}

.corporate-theme #productsView .product-field input::placeholder {
  color: #64748b;
  opacity: 1;
}

.corporate-theme #productsView .product-field input:focus {
  border-color: var(--pilot-primary-700);
  outline: 3px solid var(--pilot-focus);
  outline-offset: 1px;
  box-shadow: none;
}

.money-input-wrap {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: stretch;
}

.money-input-wrap > span {
  display: grid;
  place-items: center;
  border: 1px solid #aebfce;
  border-right: 0;
  border-radius: 7px 0 0 7px;
  color: #334155;
  background: #eef3f7;
  font-weight: 800;
}

.corporate-theme #productsView .money-input-wrap input {
  border-radius: 0 7px 7px 0;
}

.corporate-theme #productsView .product-submit {
  min-width: 156px;
  min-height: 42px;
  padding-inline: 16px;
  border-radius: 7px;
  background: var(--pilot-primary-700);
  box-shadow: 0 4px 10px rgba(11, 92, 171, .16);
  white-space: nowrap;
}

.corporate-theme #productsView .product-submit:hover {
  background: var(--pilot-primary-800);
}

.corporate-theme #productsView .enterprise-product-table-panel {
  padding: 0;
  overflow: hidden;
  border: 1px solid #d6e0e9;
  border-radius: 10px;
  box-shadow: 0 3px 12px rgba(8, 27, 44, .06);
}

.corporate-theme #productsView .product-table-intro {
  align-items: center;
  padding: 16px 18px 13px;
  border-bottom: 1px solid #dce5ed;
  background: #fff;
}

.corporate-theme #productsView .enterprise-table-wrap {
  max-height: 430px;
  overflow: auto;
}

.corporate-theme #productsView table {
  margin: 0;
}

.corporate-theme #productsView thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 14px;
  border-color: #244f76;
  color: #fff;
  background: var(--pilot-navy-800);
  font-size: .76rem;
  letter-spacing: .025em;
  text-transform: uppercase;
}

.corporate-theme #productsView tbody td {
  padding: 11px 14px;
  color: var(--pilot-text);
  font-size: .85rem;
  vertical-align: middle;
}

.corporate-theme #productsView tbody td:nth-child(3) {
  text-align: right;
  color: var(--pilot-navy-950);
  font-weight: 750;
  white-space: nowrap;
}

.corporate-theme #productsView tbody tr:nth-child(even) {
  background: #f7f9fb;
}

.corporate-theme #productsView tbody tr:hover {
  background: #edf5fb;
}

.corporate-theme #productsView .product-actions-column {
  width: 188px;
  text-align: right;
}

.corporate-theme #productsView .row-actions {
  justify-content: flex-end;
  gap: 6px;
}

.corporate-theme #productsView .row-actions .mini-btn {
  min-height: 34px;
  border-radius: 6px;
  font-size: .76rem;
}

.corporate-theme #productsView .row-actions .mini-btn.danger {
  border-color: #e7b5b0;
  color: var(--pilot-danger);
  background: #fff;
}

.corporate-theme #productsView .row-actions .mini-btn.danger:hover {
  border-color: var(--pilot-danger);
  color: #fff;
  background: var(--pilot-danger);
}

@media (max-width: 1366px) {
  .corporate-theme #saleView .sale-grid {
    grid-template-columns: minmax(440px, 1fr) minmax(350px, 390px);
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
  }

  .corporate-theme #saleView .product-buttons {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

}

@media (max-width: 1100px) {
  .corporate-theme #saleView .sale-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .corporate-theme #saleView .sale-scroll-panel {
    max-height: none;
  }

  .corporate-theme #productsView .enterprise-product-form {
    grid-template-columns: 1fr 1fr;
  }

  .corporate-theme #productsView .product-field-name {
    grid-column: 1 / -1;
  }

  .corporate-theme #productsView .product-submit {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@media (max-width: 720px) {
  .corporate-theme .enterprise-page-header,
  .sale-panel-heading,
  .product-table-intro,
  .product-form-heading {
    flex-direction: column;
  }

  .corporate-theme #saleView .sale-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .corporate-theme #saleView .cart-detail-item,
  .corporate-theme #productsView .enterprise-product-form {
    grid-template-columns: 1fr;
  }

  .corporate-theme #saleView .cart-detail-subtotal,
  .corporate-theme #saleView .cart-remove-btn,
  .corporate-theme #productsView .product-field-name,
  .corporate-theme #productsView .product-submit {
    grid-column: 1;
  }

  .corporate-theme #saleView .cart-remove-btn {
    grid-row: auto;
    justify-self: start;
  }

  .corporate-theme #productsView .product-submit {
    width: 100%;
  }
}

@media print {
  .enterprise-eyebrow,
  .enterprise-count {
    color: #000;
  }
}
