/* AquaControl V79.13: rediseño visual aislado de Domicilio y Clientes. */
.enterprise-stage2-view {
  --stage2-navy: #0a294d;
  --stage2-blue: #0e5fa8;
  --stage2-line: #dbe4ee;
  --stage2-soft: #f5f8fb;
}

/* Subnavegación solicitada dentro de Operación en vivo. */
#deliveryView .enterprise-live-tabs {
  display: flex;
  gap: 6px;
  margin: 2px 0 14px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--stage2-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(18, 42, 66, .04);
}

#deliveryView .enterprise-live-tab {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #40566d;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

#deliveryView .enterprise-live-tab:hover {
  border-color: #d5e1ec;
  color: var(--stage2-navy);
  background: #f1f6fa;
}

#deliveryView .enterprise-live-tab.active {
  border-color: var(--stage2-navy);
  color: #fff;
  background: var(--stage2-navy);
  box-shadow: 0 3px 8px rgba(10, 41, 77, .16);
}

#deliveryView .enterprise-live-tab:focus-visible {
  outline: 3px solid rgba(14, 95, 168, .25);
  outline-offset: 2px;
}

#deliveryView .enterprise-live-section-hidden {
  display: none !important;
}

#deliveryView .delivery-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 10px;
}

#deliveryView .delivery-stats > div,
#deliveryView .delivery-service-strip > div {
  min-width: 0;
  border-right: 1px solid var(--stage2-line);
}

#deliveryView .delivery-stats > div:last-child,
#deliveryView .delivery-service-strip > div:nth-child(3) { border-right: 0; }

#deliveryView .delivery-stats span,
#deliveryView .delivery-service-strip span { font-size: 12px; font-weight: 700; }
#deliveryView .delivery-stats strong,
#deliveryView .delivery-service-strip strong { font-size: 20px; color: var(--stage2-navy); }

#deliveryView .delivery-service-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  align-items: stretch;
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 1px solid var(--stage2-line);
  border-radius: 12px;
  background: #fff;
}

#deliveryView .delivery-service-strip > div { padding: 2px 16px; }
#deliveryView .delivery-service-strip > div:first-child { padding-left: 0; }
#deliveryView .delivery-service-strip p {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  padding-top: 9px;
  border-top: 1px solid var(--stage2-line);
  color: #5c6f82;
  font-size: 12px;
}

#deliveryView .delivery-orders-panel { padding: 14px; }
#deliveryView .delivery-board-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--stage2-line);
}
#deliveryView .delivery-board-heading h4 { margin: 2px 0 0; }
#deliveryView .delivery-board-heading p {
  max-width: 560px;
  margin: 0;
  color: #5c6f82;
  font-size: 12px;
  text-align: right;
}
#deliveryView .delivery-filters {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) repeat(3, minmax(145px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

#deliveryView .delivery-filters input,
#deliveryView .delivery-filters select { width: 100%; min-width: 0; }
#deliveryView .delivery-card-board.delivery-kanban-board {
  display: block;
  width: 100%;
  min-height: 300px;
  max-height: 62dvh;
  overflow-x: auto;
  overflow-y: auto;
  padding: 0 0 6px;
  border: 1px solid var(--stage2-line);
  border-radius: 9px;
  background: #f8fafc;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: auto;
  scrollbar-color: #6f8fab #edf2f6;
}

#deliveryView .delivery-card-board.delivery-kanban-board::-webkit-scrollbar {
  width: 13px;
  height: 13px;
}

#deliveryView .delivery-card-board.delivery-kanban-board::-webkit-scrollbar-thumb {
  border: 3px solid #edf2f6;
  border-radius: 999px;
  background: #6f8fab;
}

#deliveryView .delivery-card-board.delivery-kanban-board::-webkit-scrollbar-corner {
  background: #edf2f6;
}
#deliveryView .delivery-kanban {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(6, minmax(238px, 1fr));
  grid-auto-flow: column;
  min-width: 1478px;
  gap: 10px;
  align-items: start;
  justify-content: start;
}

#deliveryView .delivery-kanban-column {
  min-width: 0;
  min-height: 150px;
  border-color: var(--stage2-line);
  border-radius: 10px;
  background: var(--stage2-soft);
}

#deliveryView .delivery-kanban-column > header { min-height: 48px; flex-wrap: wrap; padding: 7px 9px; }
#deliveryView .delivery-kanban-pagination { display: flex; flex-basis: 100%; gap: 4px; }
#deliveryView .delivery-kanban-pagination .mini-btn { flex: 1; min-width: 0; min-height: 28px; padding: 3px 5px; font-size: 12px; }
#deliveryView .delivery-kanban-pagination .mini-btn:disabled { opacity: .5; cursor: default; }
#deliveryView .delivery-kanban-column > header:focus-visible { outline: 2px solid #146b91; outline-offset: -2px; }

#deliveryView .delivery-kanban-column > header strong { color: var(--stage2-navy); font-size: 13px; }
#deliveryView .delivery-kanban-column > header small { font-size: 11px; line-height: 1.35; }
#deliveryView .delivery-kanban-stack {
  max-height: none;
  overflow: visible;
  padding: 6px;
}
#deliveryView .delivery-order-card {
  width: 100%;
  min-width: 0;
  border-radius: 9px;
  box-shadow: 0 2px 7px rgba(18, 42, 66, .07);
  padding: 8px;
  gap: 6px;
}
#deliveryView .delivery-order-card,
#deliveryView .delivery-order-card button,
#deliveryView .delivery-order-card select,
#deliveryView .delivery-order-card input,
#deliveryView .delivery-quick-grid label { font-size: 12px; }
#deliveryView .delivery-card-top > div,
#deliveryView .delivery-card-customer,
#deliveryView .delivery-card-order-summary { min-width: 0; }
#deliveryView .delivery-card-customer strong,
#deliveryView .delivery-card-customer span,
#deliveryView .delivery-card-customer small { overflow-wrap: anywhere; }

#deliveryView .delivery-planning-panel,
#deliveryView .delivery-programming-panel,
#deliveryView .delivery-production-capacity-panel,
#deliveryView .delivery-plant-balance-panel,
#deliveryView .delivery-supervisor-panel,
#deliveryView .delivery-dispatch-panel { margin-bottom: 14px; }
#deliveryView .delivery-planning-head,
#deliveryView .delivery-programming-head,
#deliveryView .delivery-production-capacity-head,
#deliveryView .delivery-plant-balance-head,
#deliveryView .delivery-supervisor-head,
#deliveryView .delivery-dispatch-head { gap: 18px; }
#deliveryView .panel h4 { margin: 3px 0 5px; color: var(--stage2-navy); font-size: 17px; }
#deliveryView .panel h5 { color: var(--stage2-navy); }
#deliveryView .table-wrap { border: 1px solid var(--stage2-line); border-radius: 9px; }
#deliveryView table { font-size: 12px; }

#customersView .unified-center-tabs { margin-bottom: 12px; }
#customersView .customer-center-tab { min-height: 40px; }
#customersView .unified-center-note {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
  padding: 10px 13px;
  border-left: 3px solid var(--stage2-blue);
  border-radius: 0 8px 8px 0;
  background: #f3f7fb;
  font-size: 12px;
}
#customersView .unified-center-note strong { color: var(--stage2-navy); white-space: nowrap; }

#customersView .enterprise-customer-form {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  padding: 16px;
}

#customersView .customer-form-heading {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--stage2-line);
}
#customersView .customer-form-heading h4 { margin: 2px 0 0; color: var(--stage2-navy); font-size: 17px; }
#customersView .customer-form-heading p { margin: 0; color: #66798b; font-size: 12px; }
#customersView .customer-field { display: grid; gap: 6px; min-width: 0; }
#customersView .customer-field > span { color: #31475d; font-size: 12px; font-weight: 800; }
#customersView .customer-field input,
#customersView .customer-field select { width: 100%; min-width: 0; }
#customersView .customer-field-name { grid-column: span 4; }
#customersView .customer-field-phone { grid-column: span 3; }
#customersView .customer-field-address { grid-column: span 5; }
#customersView .customer-field-balance { grid-column: span 3; }
#customersView .customer-field-type { grid-column: span 4; }
#customersView .customer-field-price { grid-column: span 3; }
#customersView .customer-submit { grid-column: span 2; min-height: 42px; }

#customersView .customer-tools {
  grid-template-columns: minmax(280px, 1.2fr) minmax(420px, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}
#customersView .customer-tools .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#customersView .customer-tools .stat-strip > div { min-width: 0; }
#customersView .enterprise-customer-table-panel,
#customersView .enterprise-delivery-customer-table { padding: 0; overflow: hidden; }
#customersView .enterprise-table-wrap { width: 100%; overflow: auto; }
#customersView .enterprise-table-wrap table { min-width: 760px; }
#customersView .enterprise-table-wrap thead th { position: sticky; top: 0; z-index: 1; background: #eef3f8; }

#customersView .delivery-customer-admin-layout {
  grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
#customersView .enterprise-delivery-customer-form { position: sticky; top: 10px; }
#customersView .enterprise-delivery-customer-form h4 { color: var(--stage2-navy); }
#customersView .customer-admin-filters { padding: 12px; margin: 0; border-bottom: 1px solid var(--stage2-line); }

@media (max-width: 1180px) {
  #deliveryView .delivery-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #deliveryView .delivery-filters input { grid-column: 1 / -1; }
  #customersView .customer-tools { grid-template-columns: 1fr; }
  #customersView .delivery-customer-admin-layout { grid-template-columns: 1fr; }
  #customersView .enterprise-delivery-customer-form { position: static; }
}

@media (max-width: 760px) {
  #deliveryView .delivery-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #deliveryView .delivery-stats > div { border-right: 0; }
  #deliveryView .delivery-service-strip { grid-template-columns: 1fr; }
  #deliveryView .delivery-service-strip > div { padding: 8px 0; border-right: 0; border-bottom: 1px solid var(--stage2-line); }
  #deliveryView .delivery-filters { grid-template-columns: 1fr; }
  #deliveryView .delivery-filters input { grid-column: auto; }
  #deliveryView .delivery-kanban-stack { max-height: none; }
  #deliveryView .delivery-board-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  #deliveryView .delivery-board-heading p { text-align: left; }
  #customersView .enterprise-customer-form { grid-template-columns: 1fr; }
  #customersView .customer-form-heading,
  #customersView .customer-field,
  #customersView .customer-submit { grid-column: 1; }
  #customersView .customer-form-heading,
  #customersView .unified-center-note { align-items: flex-start; flex-direction: column; }
  #customersView .customer-tools .stat-strip { grid-template-columns: 1fr; }
}
