/* ==========================================================================
   DELLA CHÀ TRALCAO ERP - VENTAS COMERCIALES B2B Y DESPACHO DE BODEGA
   Tema: Corporativo Claro, Bordes Nítidos, Navy Blue, Emerald Green y Acentos Ámbar
   ========================================================================== */

:root {
  /* Paleta Corporativa B2B */
  --navy-dark: #0f172a;
  --navy-primary: #1e293b;
  --navy-light: #334155;
  --navy-subtle: #475569;

  --emerald-primary: #10b981;
  --emerald-dark: #059669;
  --emerald-light: #34d399;
  --emerald-bg: #ecfdf5;
  --emerald-border: #a7f3d0;

  --amber-primary: #d9822b;
  --amber-light: #f59e0b;
  --amber-dark: #b45309;
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;

  --rose-primary: #ef4444;
  --rose-dark: #dc2626;
  --rose-bg: #fef2f2;
  --rose-border: #fecaca;

  /* Superficies y Bordes Nítidos (Clean Light Theme) */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --border-crisp: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #1e293b;

  /* Tipografía */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;

  /* Elevaciones */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-elevated: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

/* Reset y Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   HEADER SUPERIOR (TOP NAVIGATION)
   ========================================================================== */
.b2b-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-crisp);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-badge {
  width: 44px;
  height: 44px;
  background: var(--navy-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(30, 41, 59, 0.2);
}

.brand-titles .company-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--amber-dark);
  letter-spacing: 0.8px;
}

.brand-titles h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy-primary);
  letter-spacing: -0.3px;
}

.nav-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--navy-primary);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-switch-btn:hover {
  background: var(--navy-primary);
  color: #fff;
  border-color: var(--navy-primary);
}

/* Barra de Búsqueda de Clientes B2B */
.search-container {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 42px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0 38px 0 42px;
  font-size: 0.88rem;
  color: var(--navy-primary);
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  background: #ffffff;
  border-color: var(--emerald-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

/* Dropdown de sugerencias de clientes */
.search-dropdown {
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1000;
}

.search-dropdown-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-crisp);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 0.15s;
}

.search-dropdown-item:last-child {
  border-bottom: none;
}

.search-dropdown-item:hover {
  background: var(--bg-surface-elevated);
}

.search-dropdown-item .item-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--navy-primary);
}

.search-dropdown-item .item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Botones de Acción de Cabecera */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-action-outline {
  height: 40px;
  padding: 0 16px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--navy-primary);
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action-outline:hover {
  border-color: var(--navy-primary);
  background: var(--bg-surface-elevated);
}

.btn-action-primary {
  height: 40px;
  padding: 0 18px;
  background: var(--emerald-primary);
  border: 1px solid var(--emerald-dark);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.btn-action-primary:hover {
  background: var(--emerald-dark);
  transform: translateY(-1px);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-crisp);
  border-radius: 999px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--navy-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy-primary);
}

.user-dept {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* ==========================================================================
   SUB-NAV: FILTROS POR LÍNEA Y MINI KPIS
   ========================================================================== */
.sub-nav-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-crisp);
  padding: 10px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.filter-pills-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--navy-light);
  margin-right: 4px;
}

.filter-pill {
  height: 34px;
  padding: 0 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-crisp);
  border-radius: 999px;
  color: var(--navy-light);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  background: #e2e8f0;
  color: var(--navy-primary);
}

.filter-pill.active {
  background: var(--navy-primary);
  border-color: var(--navy-primary);
  color: #ffffff;
}

.kpi-mini-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kpi-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--navy-light);
  background: var(--bg-surface-elevated);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-crisp);
}

.kpi-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-green { background-color: var(--emerald-primary); }
.dot-yellow { background-color: var(--amber-light); }
.dot-red { background-color: var(--rose-primary); }

.kpi-total-pill {
  background: var(--navy-primary);
  color: #ffffff;
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 600;
}

.kpi-total-pill strong {
  color: var(--emerald-light);
}

/* ==========================================================================
   BARRA DE CLIENTE B2B ACTIVO
   ========================================================================== */
.active-client-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-crisp);
  padding: 8px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.client-info-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.client-info-chip span {
  color: var(--text-muted);
}

.client-info-chip strong {
  color: var(--navy-primary);
  margin-left: 4px;
}

.client-rut {
  margin-left: 8px;
  background: var(--bg-surface-elevated);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--navy-light);
  font-weight: 600;
}

.client-actions-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.destination-tag {
  font-size: 0.78rem;
  color: var(--navy-light);
  font-weight: 600;
}

.btn-change-client {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--amber-dark);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-change-client:hover {
  background: var(--amber-bg);
  border-color: var(--amber-primary);
}

/* ==========================================================================
   GRILLA PRINCIPAL DE PRODUCTOS Y DESPACHO (MAIN GRID)
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 24px 28px;
  max-width: 1720px;
  width: 100%;
  margin: 0 auto;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

@media (max-width: 768px) {
  .catalog-grid {
    grid-template-columns: 1fr;
  }
}

/* Tarjeta de Producto */
.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-crisp);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.2s ease;
}

.product-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-elevated);
  transform: translateY(-2px);
}

/* Cabecera de la Tarjeta con Botella y Datos */
.product-card-top {
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--border-crisp);
}

/* Thumbnail Vectorial de Botella */
.bottle-visual-wrapper {
  width: 84px;
  height: 120px;
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #f1f5f9 100%);
  border: 1px solid var(--border-crisp);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 6px;
}

.bottle-visual-wrapper img.real-bottle-img {
  max-width: 100%;
  max-height: 110px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.22));
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover .bottle-visual-wrapper img.real-bottle-img {
  transform: scale(1.12) translateY(-2px);
}

.product-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.line-tag {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--amber-dark);
  letter-spacing: 0.5px;
}

.product-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy-primary);
  line-height: 1.25;
}

.product-specs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.abv-pill {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-crisp);
  color: var(--navy-primary);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ==========================================================================
   BADGES DE STOCK FÍSICO (REQUISITO ESTRICTO: VERDE / AMARILLO / ROJO)
   ========================================================================== */
.stock-status-section {
  padding: 12px 20px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-crisp);
}

.stock-badge {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  line-height: 1.35;
}

/* 1. GREEN BADGE: Stock disponible en bodega (> 50 cajas) */
.stock-badge.badge-green {
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  color: #065f46;
}

.stock-badge.badge-green .stock-count-highlight {
  color: #047857;
  font-weight: 800;
  font-size: 0.95rem;
}

/* 2. YELLOW BADGE: Stock crítico (< 20 cajas), pero caldo en estanque disponible para envasar */
.stock-badge.badge-yellow {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: #92400e;
}

.stock-badge.badge-yellow .stock-count-highlight {
  color: #b45309;
  font-weight: 800;
  font-size: 0.95rem;
}

/* 3. RED BADGE: Agotado en bodega & sin caldo en estanque */
.stock-badge.badge-red {
  background: var(--rose-bg);
  border: 1px solid var(--rose-border);
  color: #991b1b;
}

.stock-badge.badge-red .stock-count-highlight {
  color: #b91c1c;
  font-weight: 800;
  font-size: 0.95rem;
}

.stock-badge-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.stock-badge-content {
  display: flex;
  flex-direction: column;
}

.stock-sub-tank {
  font-size: 0.72rem;
  margin-top: 2px;
  opacity: 0.9;
}

/* ==========================================================================
   FORMULARIO RÁPIDO DE DESPACHO (QUICK DISPATCH FORM)
   ========================================================================== */
.dispatch-form-section {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  justify-content: space-between;
}

.form-row-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--navy-subtle);
  display: flex;
  justify-content: space-between;
}

.form-row-label span.bottles-equivalent {
  color: var(--amber-dark);
  font-size: 0.72rem;
  text-transform: none;
}

/* Selector numérico interactivo */
.quantity-stepper-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stepper-btn {
  width: 40px;
  height: 40px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--navy-primary);
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.stepper-btn:hover:not(:disabled) {
  background: var(--navy-primary);
  color: #fff;
}

.stepper-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.quantity-input {
  flex: 1;
  height: 40px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy-primary);
  outline: none;
  transition: all 0.2s ease;
}

.quantity-input:focus {
  border-color: var(--emerald-primary);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.quantity-input.error {
  border-color: var(--rose-primary);
  background: var(--rose-bg);
  color: var(--rose-dark);
}

/* Botón Máx */
.btn-quick-max {
  height: 40px;
  padding: 0 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--navy-light);
  cursor: pointer;
}

.btn-quick-max:hover:not(:disabled) {
  background: var(--amber-bg);
  color: var(--amber-dark);
  border-color: var(--amber-primary);
}

/* Mensaje de Validación de Stock */
.validation-error-msg {
  display: none;
  font-size: 0.75rem;
  color: var(--rose-dark);
  font-weight: 600;
  align-items: center;
  gap: 4px;
}

.validation-error-msg.visible {
  display: flex;
}

/* Botón Maestro: Generar Comanda de Salida */
.btn-dispatch-action {
  width: 100%;
  height: 44px;
  background: var(--emerald-primary);
  border: 1px solid var(--emerald-dark);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
  transition: all 0.15s ease;
}

.btn-dispatch-action:hover:not(:disabled) {
  background: var(--emerald-dark);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-dispatch-action:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-dispatch-action:disabled {
  background: var(--bg-surface-elevated);
  border-color: var(--border-crisp);
  color: var(--text-light);
  cursor: not-allowed;
  box-shadow: none;
}

/* Botón alternativo cuando está agotado */
.btn-request-bottling {
  width: 100%;
  height: 44px;
  background: var(--amber-bg);
  border: 1px dashed var(--amber-primary);
  border-radius: var(--radius-md);
  color: var(--amber-dark);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.btn-request-bottling:hover {
  background: var(--amber-primary);
  color: #fff;
}

/* ==========================================================================
   DRAWER INFERIOR: HISTORIAL DE COMANDAS Y GUÍAS (BOTTOM DRAWER)
   ========================================================================== */
.bottom-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.bottom-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -650px;
  height: 600px;
  max-height: 85vh;
  background: #ffffff;
  border-top: 2px solid var(--navy-primary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.2);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  transition: bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.bottom-drawer.active {
  bottom: 0;
}

.drawer-header {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-crisp);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.drawer-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--emerald-bg);
  color: var(--emerald-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer-title-group h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy-primary);
}

.drawer-title-group p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.drawer-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-close-drawer {
  width: 34px;
  height: 34px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-crisp);
  border-radius: 50%;
  color: var(--navy-light);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close-drawer:hover {
  background: var(--navy-primary);
  color: #fff;
}

/* Tabla de Despachos */
.drawer-table-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 0 28px 24px 28px;
}

.dispatch-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.dispatch-table th {
  background: #ffffff;
  position: sticky;
  top: 0;
  padding: 14px 12px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--navy-light);
  border-bottom: 2px solid var(--border-strong);
  letter-spacing: 0.3px;
  z-index: 5;
}

.dispatch-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-crisp);
  color: var(--navy-primary);
}

.dispatch-table tr:hover td {
  background: var(--bg-surface-elevated);
}

.tag-guia {
  font-family: monospace;
  font-weight: 700;
  background: var(--bg-surface-elevated);
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--navy-primary);
  border: 1px solid var(--border-crisp);
}

.tag-status-ok {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #065f46;
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  padding: 3px 8px;
  border-radius: 999px;
}

.tag-status-ok::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald-primary);
}

/* ==========================================================================
   MODAL DE CONFIRMACIÓN DE COMANDA DE SALIDA
   ========================================================================== */
.b2b-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 20px;
}

.b2b-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.b2b-modal-card {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.b2b-modal-backdrop.active .b2b-modal-card {
  transform: scale(1);
}

.b2b-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-crisp);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-surface-elevated);
}

.modal-badge-icon {
  width: 40px;
  height: 40px;
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.b2b-modal-header h4 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy-primary);
}

.b2b-modal-header .modal-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-modal-close {
  margin-left: auto;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
}

.b2b-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dispatch-preview-box {
  background: var(--bg-app);
  border: 1px solid var(--border-crisp);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.preview-label {
  color: var(--text-muted);
}

.preview-val {
  color: var(--navy-primary);
  font-weight: 700;
}

.highlight-boxes {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--emerald-dark);
}

.whm-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--emerald-bg);
  border: 1px solid var(--emerald-border);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  color: #065f46;
}

.b2b-modal-footer {
  padding: 16px 24px;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-crisp);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   TOASTS NOTIFICACIONES
   ========================================================================== */
.b2b-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3000;
  pointer-events: none;
}

.b2b-toast {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--emerald-primary);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  font-size: 0.88rem;
  color: var(--navy-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(15px);
  transition: all 0.25s ease;
  max-width: 440px;
}

.b2b-toast.show {
  opacity: 1;
  transform: translateY(0);
}
