/* ================================================
   ZOE POS — Design System: Navbar & Sidebar
   Principio: Minimalismo y claridad operativa
   ================================================ */

:root {
  --zoe-brand:         #352d4e;
  --zoe-brand-hover:   #2a2440;
  --zoe-brand-mid:     #5a4d7a;
  --zoe-brand-bg:      rgba(53, 45, 78, 0.07);
  --zoe-brand-bg-md:   rgba(53, 45, 78, 0.13);
  --zoe-nav-h:         52px;
  --zoe-radius:        0.5rem;
  --zoe-tr:            0.15s ease;
}

/* ── Top navbar ── */

.zoe-navbar {
  background-color: var(--zoe-brand) !important;
  height: var(--zoe-nav-h);
  position: sticky;
  top: 0;
  z-index: 1055;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.zoe-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 0.875rem;
}

/* Hamburger */
.zoe-menu-btn {
  color: rgba(255, 255, 255, 0.8);
  background: transparent;
  border: none;
  padding: 0.375rem;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--zoe-tr), color var(--zoe-tr);
  line-height: 1;
}

.zoe-menu-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.zoe-menu-btn i {
  font-size: 1.4rem;
}

/* Brand */
.zoe-brand {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.zoe-brand-name {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 2.5px;
}

.zoe-brand-tag {
  font-size: 0.58rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.85);
  padding: 0.15rem 0.45rem;
  border-radius: 0.3rem;
  letter-spacing: 0.5px;
}

/* User button */
.zoe-user-btn {
  position: relative;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.zoe-user-btn::after { display: none !important; }

.zoe-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  transition: border-color var(--zoe-tr);
}

.zoe-user-btn:hover .zoe-user-avatar {
  border-color: rgba(255, 255, 255, 0.75);
}

.zoe-online {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--zoe-brand);
}

/* ── User dropdown ── */

.zoe-user-dropdown {
  min-width: 290px !important;
  border: none !important;
  border-radius: var(--zoe-radius) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08) !important;
  padding: 0 !important;
  overflow: hidden;
  max-height: 85vh;
  overflow-y: auto;
}

.zoe-dd-head {
  background-color: var(--zoe-brand);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.zoe-dd-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.zoe-dd-name {
  font-weight: 700;
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.3;
}

.zoe-dd-meta {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.72rem;
  margin-top: 0.1rem;
}

.zoe-dd-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #9ca3af;
  padding: 0.6rem 1rem 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.zoe-dd-label i { font-size: 0.75rem; }

.zoe-dd-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.875rem;
  margin: 0.1rem 0.5rem;
  border-radius: var(--zoe-radius);
  color: #374151;
  font-size: 0.845rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--zoe-tr), color var(--zoe-tr);
  width: calc(100% - 1rem);
  background: none;
  border: none;
}

.zoe-dd-item:hover {
  background: var(--zoe-brand-bg);
  color: var(--zoe-brand);
}

.zoe-dd-item i {
  font-size: 0.875rem;
  width: 1rem;
  flex-shrink: 0;
  opacity: 0.6;
}

.zoe-dd-item:hover i { opacity: 1; }

.zoe-dd-divider {
  border: none;
  border-top: 1px solid #f3f4f6;
  margin: 0.25rem 0;
}

.zoe-dd-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: calc(100% - 1rem);
  margin: 0.25rem 0.5rem 0.5rem;
  padding: 0.55rem;
  background: #fef2f2;
  color: #dc2626;
  font-weight: 600;
  font-size: 0.845rem;
  border: none;
  border-radius: var(--zoe-radius);
  cursor: pointer;
  transition: background var(--zoe-tr);
}

.zoe-dd-logout:hover { background: #fee2e2; }

/* ── Sidebar offcanvas ── */

.zoe-sidebar {
  width: 272px !important;
}

.zoe-sidebar .offcanvas-header {
  padding: 0 1rem;
  border-bottom: 1px solid #f1f1f1;
  min-height: var(--zoe-nav-h);
}

.zoe-sidebar-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.zoe-sidebar-logo-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--zoe-brand);
  letter-spacing: 2px;
}

.zoe-sidebar-logo-tag {
  font-size: 0.58rem;
  font-weight: 700;
  background: var(--zoe-brand-bg-md);
  color: var(--zoe-brand);
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  letter-spacing: 0.5px;
}

/* Home button */
.zoe-sidebar-home {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.875rem;
  margin: 0.5rem 0.75rem 0.25rem;
  border-radius: var(--zoe-radius);
  color: #374151;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--zoe-tr), color var(--zoe-tr);
}

.zoe-sidebar-home i {
  font-size: 1rem;
  color: var(--zoe-brand-mid);
}

.zoe-sidebar-home:hover,
.zoe-sidebar-home.active {
  background: var(--zoe-brand-bg);
  color: var(--zoe-brand);
}

.zoe-sidebar-home.active i { color: var(--zoe-brand); }

/* ── Nav accordion ── */

#zoe-nav-accordion .accordion-item {
  border: none;
  background: transparent;
}

#zoe-nav-accordion .accordion-button {
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  background: transparent;
  box-shadow: none;
  border-radius: var(--zoe-radius) !important;
  gap: 0.6rem;
}

#zoe-nav-accordion .accordion-button i {
  font-size: 0.95rem;
  color: var(--zoe-brand-mid);
  width: 1.1rem;
  flex-shrink: 0;
}

#zoe-nav-accordion .accordion-button::after {
  margin-left: auto;
  filter: none;
  opacity: 0.35;
}

#zoe-nav-accordion .accordion-button:not(.collapsed) {
  color: var(--zoe-brand);
  background-color: var(--zoe-brand-bg);
}

#zoe-nav-accordion .accordion-button:not(.collapsed) i {
  color: var(--zoe-brand);
}

#zoe-nav-accordion .accordion-button:not(.collapsed)::after {
  opacity: 0.6;
}

#zoe-nav-accordion .accordion-button:hover {
  background-color: var(--zoe-brand-bg);
  color: var(--zoe-brand);
}

#zoe-nav-accordion .accordion-button:focus {
  box-shadow: none;
}

/* Nav items */
.zoe-nav-items {
  padding: 0.2rem 0.75rem 0.5rem;
}

.zoe-nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--zoe-radius);
  color: #6b7280;
  font-size: 0.83rem;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 0.1rem;
  transition: background var(--zoe-tr), color var(--zoe-tr);
}

.zoe-nav-item i {
  font-size: 0.875rem;
  width: 1rem;
  flex-shrink: 0;
  opacity: 0.65;
}

.zoe-nav-item:hover {
  background: var(--zoe-brand-bg);
  color: var(--zoe-brand);
}

.zoe-nav-item:hover i { opacity: 1; }

.zoe-nav-item.active {
  background: var(--zoe-brand-bg-md);
  color: var(--zoe-brand);
  font-weight: 600;
}

.zoe-nav-item.active i { opacity: 1; }

/* ── KPI Cards ── */

.zoe-kpi-card {
  background: #fff;
  border: 1px solid #f1f2f4;
  border-radius: var(--zoe-radius);
  padding: 0.8rem 1rem;
  height: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow var(--zoe-tr), border-color var(--zoe-tr);
}

.zoe-kpi-card:hover {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.07);
  border-color: #e2e4e9;
}

.zoe-kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #b0b7c3;
}

.zoe-kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.zoe-kpi-icon--green  { background: #dcfce7; color: #16a34a; }
.zoe-kpi-icon--purple { background: #ede9fe; color: #7c3aed; }
.zoe-kpi-icon--blue   { background: #dbeafe; color: #2563eb; }
.zoe-kpi-icon--amber  { background: #fef3c7; color: #d97706; }
.zoe-kpi-icon--red    { background: #fee2e2; color: #dc2626; }

/* Accent border para cards de alerta */
.zoe-kpi-card--warning { border-left: 3px solid #f59e0b; }
.zoe-kpi-card--danger  { border-left: 3px solid #ef4444; }

/* Cards clickeables (envueltas en <a>) */
a .zoe-kpi-card { color: inherit; }

/* Ícono de info integrado en el label */
.zoe-kpi-label .zoe-kpi-info {
  opacity: 0.3;
  font-size: 0.6rem;
  margin-left: 0.15rem;
  vertical-align: middle;
  transition: opacity var(--zoe-tr);
}

.zoe-kpi-card:hover .zoe-kpi-label .zoe-kpi-info {
  opacity: 0.6;
}

.zoe-kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #4b5563;
  line-height: 1.2;
  margin: 0.35rem 0 0.2rem;
}

/* El valor toma el color de acento de cada card */
.zoe-kpi-card--purple .zoe-kpi-value { color: #7c3aed; }
.zoe-kpi-card--blue   .zoe-kpi-value { color: #2563eb; }
.zoe-kpi-card--green  .zoe-kpi-value { color: #16a34a; }
.zoe-kpi-card--warning .zoe-kpi-value { color: #d97706; }
.zoe-kpi-card--danger  .zoe-kpi-value { color: #dc2626; }

.zoe-kpi-sub {
  font-size: 0.72rem;
  color: #b0b7c3;
}

/* ── Filters Bar ── */

.zoe-filters-bar {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: var(--zoe-radius);
  padding: 0.4rem 0.6rem;
  margin-bottom: 1rem;
}

.zoe-filter-control {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  height: 34px;
  padding: 0 0.65rem;
  background: #f9fafb;
  border: 1px solid #e9ecef;
  border-radius: var(--zoe-radius);
  transition: border-color var(--zoe-tr);
}

.zoe-filter-control:focus-within {
  border-color: var(--zoe-brand-mid);
}

.zoe-filter-control > i {
  color: var(--zoe-brand-mid);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.zoe-filter-select {
  border: none;
  background: transparent;
  font-size: 0.845rem;
  color: #374151;
  flex: 1;
  outline: none;
  min-width: 0;
  cursor: pointer;
  font-family: inherit;
}

.zoe-filter-date {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  height: 34px;
  padding: 0 0.65rem;
  background: #f9fafb;
  border: 1px solid #e9ecef;
  border-radius: var(--zoe-radius);
  color: #374151;
  font-size: 0.845rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--zoe-tr), background var(--zoe-tr);
  text-align: left;
}

.zoe-filter-date:hover {
  border-color: var(--zoe-brand-mid);
  background: var(--zoe-brand-bg);
}

.zoe-filter-date > i:first-child {
  color: var(--zoe-brand-mid);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.zoe-filter-date > span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zoe-filter-date > i:last-child {
  color: #c4c8d0;
  font-size: 0.7rem;
  flex-shrink: 0;
}

/* ── SRI webservices status bar ── */

.zoe-sri-statusbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  background: #fff;
  border: 1px solid #e9ecef;
  border-left: 3px solid #cbd0d8;
  border-radius: var(--zoe-radius);
  padding: 0.5rem 0.85rem;
  margin-bottom: 1rem;
  cursor: help;
  transition: border-color var(--zoe-tr);
}

.zoe-sri-statusbar[data-state="online"]   { border-left-color: #22c55e; }
.zoe-sri-statusbar[data-state="degraded"] { border-left-color: #f59e0b; }
.zoe-sri-statusbar[data-state="offline"]  { border-left-color: #ef4444; }

.zoe-sri-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #4b5563;
}

.zoe-sri-brand > i {
  color: var(--zoe-brand-mid);
  font-size: 0.95rem;
}

.zoe-sri-ambiente {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #6b7280;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

.zoe-sri-services {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  flex: 1;
}

.zoe-sri-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}

.zoe-sri-name {
  font-weight: 600;
  color: #4b5563;
}

.zoe-sri-state {
  font-size: 0.72rem;
  color: #9ca3af;
}

.zoe-sri-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cbd0d8;
  flex-shrink: 0;
}

.zoe-sri-item[data-state="online"]   .zoe-sri-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.zoe-sri-item[data-state="degraded"] .zoe-sri-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.zoe-sri-item[data-state="offline"]  .zoe-sri-dot { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }

.zoe-sri-item[data-state="online"]   .zoe-sri-state { color: #16a34a; }
.zoe-sri-item[data-state="degraded"] .zoe-sri-state { color: #d97706; }
.zoe-sri-item[data-state="offline"]  .zoe-sri-state { color: #dc2626; }

/* Estado "comprobando": punto gris pulsante */
.zoe-sri-statusbar[data-state="checking"] .zoe-sri-dot { animation: zoe-sri-pulse 1.1s ease-in-out infinite; }

@keyframes zoe-sri-pulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}

.zoe-sri-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.zoe-sri-checked {
  font-size: 0.68rem;
  color: #b0b7c3;
}

.zoe-sri-refresh {
  border: 1px solid #e9ecef;
  background: #f9fafb;
  color: #6b7280;
  width: 28px;
  height: 28px;
  border-radius: var(--zoe-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color var(--zoe-tr), background var(--zoe-tr), color var(--zoe-tr);
}

.zoe-sri-refresh:hover {
  border-color: var(--zoe-brand-mid);
  background: var(--zoe-brand-bg);
  color: var(--zoe-brand-mid);
}

.zoe-sri-refresh.is-loading > i {
  display: inline-block;
  animation: zoe-sri-spin 0.8s linear infinite;
}

@keyframes zoe-sri-spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive: tablets y móviles ── */

/* Tablets y móviles medianos: la meta (hora + refresco) baja a su propia línea
   ocupando todo el ancho, separada del resto. */
@media (max-width: 767.98px) {
  .zoe-sri-services {
    flex: 1 1 100%;
  }

  .zoe-sri-meta {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
    padding-top: 0.4rem;
    border-top: 1px solid #f1f2f4;
  }
}

/* Móviles: todo apilado en vertical y cada servicio en su propia fila,
   con el estado alineado a la derecha para una lectura cómoda. */
@media (max-width: 575.98px) {
  .zoe-sri-statusbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .zoe-sri-brand {
    justify-content: space-between;
  }

  .zoe-sri-services {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .zoe-sri-item {
    width: 100%;
  }

  .zoe-sri-item .zoe-sri-state {
    margin-left: auto;
  }

  .zoe-sri-meta {
    justify-content: space-between;
  }

  .zoe-sri-checked:empty::before {
    content: "—";
  }
}

/* Contenido del tooltip de estado del SRI */
.zoe-sri-tip {
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.35;
}

.zoe-sri-tip strong {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.zoe-sri-tip strong > i {
  margin-right: 0.25rem;
}

.zoe-sri-tip p {
  margin: 0;
  color: #6b7280;
}

/* Tema claro propio para el tooltip (el bundle de tippy solo trae el oscuro) */
.tippy-box[data-theme~="zoe"] {
  background-color: #ffffff;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: var(--zoe-radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.tippy-box[data-theme~="zoe"] > .tippy-arrow::before {
  color: #ffffff;
}

.tippy-box[data-theme~="zoe"][data-placement^="bottom"] > .tippy-arrow::after {
  content: "";
  position: absolute;
  border: 8px solid transparent;
  border-bottom-color: #e5e7eb;
  top: -1px;
  left: -8px;
  z-index: -1;
}

/* Version footer */
.zoe-sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid #f1f1f1;
  color: #c4c8d0;
  font-size: 0.7rem;
  text-align: center;
}

/* ── Section / card titles ── */

.zoe-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--zoe-brand-mid);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.zoe-section-title i {
  color: var(--zoe-brand-mid);
  opacity: 0.7;
}

/* ── Module page header ── */

.zoe-page-header {
  background-color: var(--zoe-brand);
  border-radius: var(--zoe-radius);
  padding: 0.7rem 1rem;
}

.zoe-page-header-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.zoe-page-header-title i { opacity: 0.8; }

/* ── Form field labels ── */

.zoe-field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #6b7280;
  margin-bottom: 0.3rem;
}

/* ── Invoice columns header ── */

.zoe-invoice-header {
  background-color: var(--zoe-brand);
  border-radius: var(--zoe-radius);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 0.5rem;
}

/* ── Invoice product items ── */

.invoice-item {
  border: 1px solid #e2e8f0;
  border-radius: var(--zoe-radius);
  margin-bottom: 0.35rem;
  background: #fff;
  transition: background-color var(--zoe-tr), border-color var(--zoe-tr);
}

.invoice-item:last-child { margin-bottom: 0; }

.invoice-item:hover {
  background-color: var(--zoe-brand-bg);
  border-color: var(--zoe-brand-bg-md);
}

.invoice-item .productDescription {
  font-size: 0.83rem;
  color: #1f2937;
  line-height: 1.4;
}

/* Botones +/- cantidad */
.invoice-item .changeQuantity { align-items: center; }

.invoice-item .minus1,
.invoice-item .plus1 {
  width: 100%;
  font-size: 0.875rem;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0.25rem;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--zoe-tr);
}

.invoice-item .minus1          { color: #dc2626; background: #fee2e2 !important; }
.invoice-item .minus1:hover    { background: #fecaca !important; }
.invoice-item .plus1           { color: #16a34a; background: #dcfce7 !important; }
.invoice-item .plus1:hover     { background: #bbf7d0 !important; }

/* Inputs de solo lectura */
.invoice-item .retailPrice,
.invoice-item .unitPrice,
.invoice-item .subtotalPrice,
.invoice-item .discountPrice,
.invoice-item .porcentajeIva {
  background-color: #f9fafb !important;
  border-color: #e9ecef !important;
  font-size: 0.8rem;
  color: var(--zoe-brand-mid) !important;
}

/* Re-habilita eventos de ratón en el botón "ya agregado" para que el click
   llegue al handler de re-clic. Bootstrap pone pointer-events:none en .btn.disabled. */
.btn.bg-success-subtle.restoreButton,
.btn.bg-success-subtle.restoreButtonProforma,
.btn.bg-success-subtle.restoreButtonToBringBack {
  pointer-events: auto !important;
  cursor: pointer;
}

/* Botón quitar */
.invoice-item .btnRemoveProduct,
.invoice-item .btnRemovePurchaseProduct,
.invoice-item .btnRemoveProformaProduct,
.invoice-item .btnRemoveBringBackProduct {
  padding: 0.25rem 0.4rem;
  opacity: 0.55;
  transition: opacity var(--zoe-tr);
}

.invoice-item .btnRemoveProduct:hover,
.invoice-item .btnRemovePurchaseProduct:hover,
.invoice-item .btnRemoveProformaProduct:hover,
.invoice-item .btnRemoveBringBackProduct:hover { opacity: 1; }

/* Flash al re-clic desde la lista de productos */
@keyframes invoice-item-flash {
  0%, 100% { background-color: #fff;                        border-color: #e2e8f0; }
  40%       { background-color: rgba(90, 77, 122, 0.12);    border-color: var(--zoe-brand-mid); }
}

.invoice-item-flash { animation: invoice-item-flash 0.8s ease; }

/* ── Product list DataTable ── */

/* Header */
#product-list-table thead tr th,
#purchase-product-list-table thead tr th,
#proforma-product-list-table thead tr th,
#return-product-list-table thead tr th,
#product-list-table-from-return-modal thead tr th {
  background-color: var(--zoe-brand-bg) !important;
  box-shadow: none !important;
  color: var(--zoe-brand);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--zoe-brand-bg-md) !important;
  padding: 0.6rem 0.75rem;
  white-space: nowrap;
}

/* Body rows */
#product-list-table tbody tr,
#purchase-product-list-table tbody tr,
#proforma-product-list-table tbody tr,
#return-product-list-table tbody tr,
#product-list-table-from-return-modal tbody tr {
  border-bottom: 1px solid #f1f2f4;
  transition: background-color var(--zoe-tr);
}

#product-list-table tbody tr:last-child,
#purchase-product-list-table tbody tr:last-child,
#proforma-product-list-table tbody tr:last-child,
#return-product-list-table tbody tr:last-child,
#product-list-table-from-return-modal tbody tr:last-child {
  border-bottom: none;
}

/* Bootstrap 5 aplica el hover via box-shadow inset, no background-color.
   Hay que pisar la CSS variable --bs-table-bg-state para que tome el color. */
#product-list-table.table-hover > tbody > tr:hover > *,
#purchase-product-list-table.table-hover > tbody > tr:hover > *,
#proforma-product-list-table.table-hover > tbody > tr:hover > *,
#return-product-list-table.table-hover > tbody > tr:hover > *,
#product-list-table-from-return-modal.table-hover > tbody > tr:hover > * {
  --bs-table-color-state: #1f2937;
  --bs-table-bg-state: var(--zoe-brand-bg);
}

/* Product description cell: name / stock / price */
#product-list-table td:first-child,
#purchase-product-list-table td:first-child,
#proforma-product-list-table td:first-child,
#return-product-list-table td:first-child,
#product-list-table-from-return-modal td:first-child {
  padding: 0.5rem 0.75rem;
  vertical-align: middle;
}

#product-list-table td:first-child p.fw-bold,
#purchase-product-list-table td:first-child p.fw-bold,
#proforma-product-list-table td:first-child p.fw-bold,
#return-product-list-table td:first-child p.fw-bold,
#product-list-table-from-return-modal td:first-child p.fw-bold {
  font-size: 0.83rem;
  color: #1f2937;
  line-height: 1.3;
  margin-bottom: 0.2rem !important;
}

/* Stock pill */
#product-list-table td span.text-danger,
#product-list-table td span.text-warning,
#product-list-table td span.text-success,
#purchase-product-list-table td span.text-danger,
#purchase-product-list-table td span.text-warning,
#purchase-product-list-table td span.text-success,
#proforma-product-list-table td span.text-danger,
#return-product-list-table td span.text-danger,
#proforma-product-list-table td span.text-warning,
#return-product-list-table td span.text-warning,
#proforma-product-list-table td span.text-success,
#return-product-list-table td span.text-success {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  display: inline-block;
  align-self: flex-start;
  margin-bottom: 0.15rem;
}

#product-list-table td span.text-danger,
#purchase-product-list-table td span.text-danger,
#proforma-product-list-table td span.text-danger  { background: #fee2e2; color: #dc2626 !important; }
#return-product-list-table td span.text-danger  { background: #fee2e2; color: #dc2626 !important; }
#product-list-table td span.text-warning,
#purchase-product-list-table td span.text-warning,
#proforma-product-list-table td span.text-warning { background: #fef3c7; color: #b45309 !important; }
#return-product-list-table td span.text-warning { background: #fef3c7; color: #b45309 !important; }
#product-list-table td span.text-success,
#purchase-product-list-table td span.text-success,
#proforma-product-list-table td span.text-success { background: #dcfce7; color: #16a34a !important; }
#return-product-list-table td span.text-success { background: #dcfce7; color: #16a34a !important; }

/* Price */
#product-list-table td span.text-muted.fw-bold,
#purchase-product-list-table td span.text-muted.fw-bold,
#proforma-product-list-table td span.text-muted.fw-bold,
#return-product-list-table td span.text-muted.fw-bold {
  font-size: 0.8rem;
  color: var(--zoe-brand-mid) !important;
  font-weight: 600 !important;
}

/* Add button column */
#product-list-table td:last-child,
#purchase-product-list-table td:last-child,
#proforma-product-list-table td:last-child,
#return-product-list-table td:last-child,
#product-list-table-from-return-modal td:last-child {
  padding: 0.4rem 0.5rem;
  vertical-align: middle;
}

/* Columna del botón — ancho mínimo, sin max-width para no recortar en zoom alto */
#product-list-table-from-return-modal td:last-child,
#product-list-table-from-return-modal th:last-child,
#invoice-product-list-to-return td:last-child,
#invoice-product-list-to-return th:last-child {
  width: 1%;
  white-space: nowrap;
}

/* Tabla de items de factura: layout fijo con % para contener el botón
   en cualquier zoom o tamaño de pantalla */
#invoice-product-list-to-return {
  table-layout: fixed;
  width: 100%;
}

#invoice-product-list-to-return th:first-child,
#invoice-product-list-to-return td:first-child {
  width: 78%;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: break-word;
}

#invoice-product-list-to-return th:last-child,
#invoice-product-list-to-return td:last-child {
  width: 22%;
  padding: 0.4rem 0.35rem;
  vertical-align: middle;
  text-align: center;
}

/* Wrappers del DataTable — scroll si la tabla excede el contenedor */
#product-list-table-from-return-modal_wrapper,
#invoice-product-list-to-return_wrapper {
  overflow-x: auto;
}

/* Pagination — fix bug heredado (styles.css pone red !important en active) */
#product-list-table_wrapper .page-item.active .page-link,
#purchase-product-list-table_wrapper .page-item.active .page-link,
#proforma-product-list-table_wrapper .page-item.active .page-link,
#return-product-list-table_wrapper .page-item.active .page-link,
#product-list-table-from-return-modal_wrapper .page-item.active .page-link {
  background-color: var(--zoe-brand) !important;
  border-color: var(--zoe-brand) !important;
  color: #fff !important;
  box-shadow: none;
}

#product-list-table_wrapper .page-link,
#purchase-product-list-table_wrapper .page-link,
#proforma-product-list-table_wrapper .page-link,
#return-product-list-table_wrapper .page-link,
#product-list-table-from-return-modal_wrapper .page-link {
  color: var(--zoe-brand) !important;
  border-color: #e9ecef !important;
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
  transition: background-color var(--zoe-tr), border-color var(--zoe-tr);
}

#product-list-table_wrapper .page-link:hover,
#purchase-product-list-table_wrapper .page-link:hover,
#proforma-product-list-table_wrapper .page-link:hover,
#return-product-list-table_wrapper .page-link:hover,
#product-list-table-from-return-modal_wrapper .page-link:hover {
  background-color: var(--zoe-brand-bg) !important;
  border-color: var(--zoe-brand-mid) !important;
  color: var(--zoe-brand) !important;
}

#product-list-table_wrapper .page-item.disabled .page-link,
#purchase-product-list-table_wrapper .page-item.disabled .page-link,
#proforma-product-list-table_wrapper .page-item.disabled .page-link,
#return-product-list-table_wrapper .page-item.disabled .page-link,
#product-list-table-from-return-modal_wrapper .page-item.disabled .page-link {
  color: #c4c8d0 !important;
  border-color: #f1f2f4 !important;
}

/* Empty state */
#product-list-table tbody td.dataTables_empty,
#purchase-product-list-table tbody td.dataTables_empty,
#proforma-product-list-table tbody td.dataTables_empty,
#return-product-list-table tbody td.dataTables_empty,
#product-list-table-from-return-modal tbody td.dataTables_empty {
  color: #9ca3af;
  font-size: 0.875rem;
  padding: 1.5rem 0;
  text-align: center;
  font-style: italic;
}

/* ── Product list search (DataTable filter) ── */

#product-list-table_filter,
#purchase-product-list-table_filter,
#proforma-product-list-table_filter,
#return-product-list-table_filter,
#product-list-table-from-return-modal_filter {
  padding: 0.5rem 0.75rem 0.25rem;
}

#product-list-table_filter label,
#purchase-product-list-table_filter label,
#proforma-product-list-table_filter label,
#return-product-list-table_filter label,
#product-list-table-from-return-modal_filter label {
  position: relative;
  display: block;
  margin: 0;
}

#product-list-table_filter label::before,
#purchase-product-list-table_filter label::before,
#proforma-product-list-table_filter label::before,
#return-product-list-table_filter label::before,
#product-list-table-from-return-modal_filter label::before {
  font-family: bootstrap-icons !important;
  font-style: normal;
  font-weight: normal !important;
  content: "\f52a";
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--zoe-brand-mid);
  font-size: 0.875rem;
  pointer-events: none;
  z-index: 2;
}

#product-list-table_filter input[type="search"],
#purchase-product-list-table_filter input[type="search"],
#proforma-product-list-table_filter input[type="search"],
#return-product-list-table_filter input[type="search"],
#product-list-table-from-return-modal_filter input[type="search"] {
  width: 100% !important;
  padding-left: 2.1rem !important;
  padding-right: 3.5rem !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: var(--zoe-radius) !important;
  background-color: #f9fafb !important;
  text-align: left !important;
  color: #374151 !important;
  font-size: 0.875rem !important;
  box-shadow: none !important;
  outline: none !important;
  transition: border-color var(--zoe-tr), background-color var(--zoe-tr), box-shadow var(--zoe-tr) !important;
}

#product-list-table_filter input[type="search"]:focus,
#purchase-product-list-table_filter input[type="search"]:focus,
#proforma-product-list-table_filter input[type="search"]:focus,
#return-product-list-table_filter input[type="search"]:focus,
#product-list-table-from-return-modal_filter input[type="search"]:focus {
  border-color: var(--zoe-brand-mid) !important;
  background-color: #fff !important;
  box-shadow: 0 0 0 3px rgba(90, 77, 122, 0.12) !important;
}

.zoe-search-shortcut {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--zoe-brand-bg-md);
  color: var(--zoe-brand);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  line-height: 1.5;
  pointer-events: none;
  z-index: 2;
  opacity: 0.7;
  transition: opacity var(--zoe-tr);
}

#product-list-table_filter input[type="search"]:focus ~ .zoe-search-shortcut,
#purchase-product-list-table_filter input[type="search"]:focus ~ .zoe-search-shortcut,
#proforma-product-list-table_filter input[type="search"]:focus ~ .zoe-search-shortcut,
#return-product-list-table_filter input[type="search"]:focus ~ .zoe-search-shortcut,
#product-list-table-from-return-modal_filter input[type="search"]:focus ~ .zoe-search-shortcut {
  opacity: 0.2;
}

@keyframes zoe-search-flash {
  0%   { box-shadow: 0 0 0 0 rgba(90, 77, 122, 0); }
  40%  { box-shadow: 0 0 0 5px rgba(90, 77, 122, 0.22); }
  100% { box-shadow: 0 0 0 3px rgba(90, 77, 122, 0.12); }
}

#product-list-table_filter label.zoe-search-flash input[type="search"],
#purchase-product-list-table_filter label.zoe-search-flash input[type="search"],
#proforma-product-list-table_filter label.zoe-search-flash input[type="search"],
#return-product-list-table_filter label.zoe-search-flash input[type="search"] {
  animation: zoe-search-flash 0.4s ease forwards;
}

/* ── Brand primary button ──
   Especificidad doble (.btn.zoe-btn-brand) para ganar sobre home.css que
   define .btn { background-color: transparent } y carga después de este archivo. */

.btn.zoe-btn-brand {
  background-color: var(--zoe-brand);
  border-color: var(--zoe-brand);
  color: #fff;
  transition: background-color var(--zoe-tr), border-color var(--zoe-tr), box-shadow var(--zoe-tr);
}

.btn.zoe-btn-brand:hover {
  background-color: var(--zoe-brand-hover);
  border-color: var(--zoe-brand-hover);
  color: #fff;
}

.btn.zoe-btn-brand:focus,
.btn.zoe-btn-brand:focus-visible {
  background-color: var(--zoe-brand-hover);
  border-color: var(--zoe-brand-hover);
  color: #fff;
  box-shadow: 0 0 0 0.2rem rgba(53, 45, 78, 0.35);
}

.btn.zoe-btn-brand:active {
  background-color: var(--zoe-brand-hover);
  border-color: var(--zoe-brand-hover);
  color: #fff;
}
