/* =========================================================
   WIRTZ HUB · EVENTOS · EGRESOS DE STOCK
   Descuento stock · auditoría · CSV · manual
   Premium · minimalista · responsive · dark safe
   ========================================================= */

/* =========================================================
   PAGE
   ========================================================= */

.stock-out-page {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 7px;
  min-height: calc(100vh - var(--topbar-height) - 44px);
  animation: stockOutPageIn 0.24s ease both;
}

/* =========================================================
   BLOQUES BASE
   ========================================================= */

.stock-out-head,
.stock-out-metrics,
.stock-out-panel {
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--panel-solid) 97%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.035),
    0 12px 28px rgba(0, 0, 0, 0.035);
  overflow: hidden;
  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

html[data-theme="dark"] .stock-out-head,
html[data-theme="dark"] .stock-out-metrics,
html[data-theme="dark"] .stock-out-panel {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(10, 10, 10, 0.9);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03),
    0 14px 32px rgba(0, 0, 0, 0.28);
}

/* =========================================================
   HEADER
   ========================================================= */

.stock-out-head {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 8px;
}

.stock-out-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stock-out-brand__icon {
  display: grid;
  width: 30px;
  height: 30px;
  min-width: 30px;
  place-items: center;
  border: 1px solid color-mix(in srgb, #ea580c 28%, rgba(0, 0, 0, 0.12));
  border-radius: 10px;
  background: color-mix(in srgb, #ea580c 6%, transparent);
  color: #ea580c;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    transform var(--transition),
    filter var(--transition);
}

.stock-out-head:hover .stock-out-brand__icon {
  transform: translateY(-1px);
  filter: saturate(1.12) contrast(1.03);
}

html[data-theme="dark"] .stock-out-brand__icon {
  border-color: color-mix(in srgb, #fb923c 30%, rgba(255, 255, 255, 0.12));
  background: color-mix(in srgb, #fb923c 8%, transparent);
  color: #fb923c;
}

.stock-out-brand__icon .icon {
  width: 15px;
  height: 15px;
  stroke-width: 2.15;
}

.stock-out-brand h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.055em;
}

.stock-out-brand p {
  margin: 2px 0 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 760;
  line-height: 1.28;
}

html[data-theme="dark"] .stock-out-brand h2 {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .stock-out-brand p {
  color: rgba(255, 255, 255, 0.48);
}

.stock-out-actions,
.stock-out-filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}

/* =========================================================
   BOTONES
   ========================================================= */

.stock-out-btn,
.stock-out-action,
.stock-out-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 27px;
  padding: 5px 8px;
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 8px;
  background: transparent;
  color: var(--text-strong);
  font-size: 8.3px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    transform var(--transition),
    opacity var(--transition);
}

.stock-out-btn:hover,
.stock-out-action:hover,
.stock-out-modal__close:hover {
  border-color: rgba(0, 0, 0, 0.24);
  background: rgba(0, 0, 0, 0.055);
}

.stock-out-btn:active,
.stock-out-action:active,
.stock-out-modal__close:active {
  transform: scale(0.98);
}

.stock-out-btn:focus-visible,
.stock-out-action:focus-visible,
.stock-out-modal__close:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--text-strong) 16%, transparent);
}

.stock-out-btn .icon,
.stock-out-action .icon,
.stock-out-modal__close .icon {
  width: 11px;
  height: 11px;
  stroke-width: 2.15;
}

html[data-theme="dark"] .stock-out-btn,
html[data-theme="dark"] .stock-out-action,
html[data-theme="dark"] .stock-out-modal__close {
  border-color: rgba(255, 255, 255, 0.13);
  color: #ffffff;
}

html[data-theme="dark"] .stock-out-btn:hover,
html[data-theme="dark"] .stock-out-action:hover,
html[data-theme="dark"] .stock-out-modal__close:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.075);
}

.stock-out-btn--dark,
.stock-out-action--dark {
  border-color: rgba(17, 24, 39, 0.92);
  background: rgba(17, 24, 39, 0.96);
  color: #ffffff;
}

.stock-out-btn--dark:hover,
.stock-out-action--dark:hover {
  border-color: rgba(17, 24, 39, 1);
  background: rgba(17, 24, 39, 0.9);
  opacity: 0.96;
}

html[data-theme="dark"] .stock-out-btn--dark,
html[data-theme="dark"] .stock-out-action--dark {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

html[data-theme="dark"] .stock-out-btn--dark:hover,
html[data-theme="dark"] .stock-out-action--dark:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.15);
}

.stock-out-btn--danger {
  border-color: color-mix(in srgb, var(--danger) 48%, rgba(0, 0, 0, 0.13));
  color: var(--danger);
}

.stock-out-btn--danger:hover {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

/* =========================================================
   MÉTRICAS
   ========================================================= */

.stock-out-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stock-out-metric {
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 9px 10px;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  background: transparent;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.stock-out-metric:last-child {
  border-right: 0;
}

.stock-out-metric:hover {
  background: rgba(0, 0, 0, 0.045);
}

html[data-theme="dark"] .stock-out-metric {
  border-right-color: rgba(255, 255, 255, 0.09);
}

html[data-theme="dark"] .stock-out-metric:hover {
  background: rgba(255, 255, 255, 0.065);
}

.stock-out-metric span {
  min-width: 0;
  color: var(--muted);
  font-size: 7.5px;
  font-weight: 950;
  letter-spacing: 0.085em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-out-metric strong {
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.065em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-out-metric small {
  color: var(--muted-2);
  font-size: 7.3px;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-theme="dark"] .stock-out-metric span {
  color: rgba(255, 255, 255, 0.48);
}

html[data-theme="dark"] .stock-out-metric strong {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .stock-out-metric small {
  color: rgba(255, 255, 255, 0.38);
}

.stock-out-metric:nth-child(1) strong {
  color: #ea580c;
}

.stock-out-metric:nth-child(2) strong {
  color: #dc2626;
}

.stock-out-metric:nth-child(3) strong {
  color: #2563eb;
}

.stock-out-metric:nth-child(4) strong {
  color: #7c3aed;
}

.stock-out-metric:nth-child(5) strong {
  color: #ca8a04;
}

.stock-out-metric:nth-child(6) strong {
  color: #16a34a;
}

html[data-theme="dark"] .stock-out-metric:nth-child(1) strong {
  color: #fb923c;
}

html[data-theme="dark"] .stock-out-metric:nth-child(2) strong {
  color: #f87171;
}

html[data-theme="dark"] .stock-out-metric:nth-child(3) strong {
  color: #60a5fa;
}

html[data-theme="dark"] .stock-out-metric:nth-child(4) strong {
  color: #a78bfa;
}

html[data-theme="dark"] .stock-out-metric:nth-child(5) strong {
  color: #facc15;
}

html[data-theme="dark"] .stock-out-metric:nth-child(6) strong {
  color: #4ade80;
}

/* =========================================================
   PANEL
   ========================================================= */

.stock-out-panel {
  display: grid;
  min-width: 0;
}

.stock-out-toolbar {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .stock-out-toolbar {
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

.stock-out-title {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.stock-out-title span {
  color: var(--muted);
  font-size: 7.2px;
  font-weight: 950;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.stock-out-title strong {
  color: var(--text-strong);
  font-size: 11px;
  font-weight: 950;
  line-height: 1.1;
  letter-spacing: -0.045em;
}

html[data-theme="dark"] .stock-out-title span {
  color: rgba(255, 255, 255, 0.48);
}

html[data-theme="dark"] .stock-out-title strong {
  color: rgba(255, 255, 255, 0.92);
}

/* =========================================================
   FILTROS
   ========================================================= */

.stock-out-search {
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(390px, 100%);
  min-width: 240px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.stock-out-search:focus-within {
  border-color: rgba(0, 0, 0, 0.28);
  background: rgba(0, 0, 0, 0.045);
}

html[data-theme="dark"] .stock-out-search {
  border-color: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.48);
}

html[data-theme="dark"] .stock-out-search:focus-within {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.065);
}

.stock-out-search .icon {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  stroke-width: 2.15;
  color: #2563eb;
}

html[data-theme="dark"] .stock-out-search .icon {
  color: #60a5fa;
}

.stock-out-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text-strong);
  outline: none;
  font-size: 8.8px;
  font-weight: 780;
}

.stock-out-search input::placeholder {
  color: var(--muted-2);
}

html[data-theme="dark"] .stock-out-search input {
  color: rgba(255, 255, 255, 0.9);
}

html[data-theme="dark"] .stock-out-search input::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.stock-out-filters select {
  height: 28px;
  min-width: 104px;
  padding: 0 8px;
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 8px;
  background: transparent;
  color: var(--text-strong);
  outline: none;
  font-size: 8.3px;
  font-weight: 850;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.stock-out-filters select:hover,
.stock-out-filters select:focus {
  border-color: rgba(0, 0, 0, 0.28);
  background: rgba(0, 0, 0, 0.045);
}

html[data-theme="dark"] .stock-out-filters select {
  border-color: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.88);
}

html[data-theme="dark"] .stock-out-filters select:hover,
html[data-theme="dark"] .stock-out-filters select:focus {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.065);
}

/* =========================================================
   TABLA
   ========================================================= */

.stock-out-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 128, 145, 0.35) transparent;
}

.stock-out-table-wrap::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.stock-out-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.stock-out-table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(120, 128, 145, 0.35);
  background-clip: content-box;
}

.stock-out-table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 128, 145, 0.55);
  background-clip: content-box;
}

.stock-out-table {
  width: 100%;
  min-width: 1120px;
  table-layout: fixed;
  border-collapse: collapse;
  background: transparent;
}

.stock-out-table th,
.stock-out-table td {
  position: relative;
  height: 31px;
  padding: 0 12px 0 10px !important;
  border-right: 0 !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: none !important;
  color: var(--text);
  font-size: 8.45px;
  font-weight: 720;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-theme="dark"] .stock-out-table th,
html[data-theme="dark"] .stock-out-table td {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
}

.stock-out-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--panel-solid) 98%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--muted);
  font-size: 6.9px;
  font-weight: 950;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

html[data-theme="dark"] .stock-out-table th {
  background: rgba(10, 10, 10, 0.98);
  color: rgba(255, 255, 255, 0.46);
}

.stock-out-table th:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 1px;
  height: 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
  transform: translateY(-50%);
}

.stock-out-table td:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 1px;
  height: 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.105);
  transform: translateY(-50%);
}

html[data-theme="dark"] .stock-out-table th:not(:last-child)::after {
  background: rgba(255, 255, 255, 0.18);
}

html[data-theme="dark"] .stock-out-table td:not(:last-child)::after {
  background: rgba(255, 255, 255, 0.11);
}

.stock-out-table tbody tr {
  transition:
    background var(--transition),
    color var(--transition);
}

.stock-out-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.045);
}

.stock-out-table tbody tr:hover td:not(:last-child)::after {
  background: rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] .stock-out-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .stock-out-table tbody tr:hover td:not(:last-child)::after {
  background: rgba(255, 255, 255, 0.2);
}

.stock-out-table tbody tr:last-child td {
  border-bottom: 0;
}

.stock-out-table strong {
  color: var(--text-strong);
  font-weight: 950;
}

html[data-theme="dark"] .stock-out-table strong {
  color: rgba(255, 255, 255, 0.9);
}

.stock-out-table td:nth-child(4),
.stock-out-table th:nth-child(4) {
  max-width: none !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-out-table td:nth-child(5),
.stock-out-table th:nth-child(5),
.stock-out-table td:nth-child(10),
.stock-out-table th:nth-child(10) {
  text-align: right !important;
}

/* =========================================================
   ORDENAMIENTO + COLUMNAS REDIMENSIONABLES
   ========================================================= */

.stock-out-th {
  position: sticky;
  top: 0;
  z-index: 3;
  overflow: visible !important;
}

.stock-out-th__sort {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  width: calc(100% - 8px);
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.stock-out-th__sort:disabled {
  cursor: default;
}

.stock-out-th__sort span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-out-th__sort .icon {
  width: 10px;
  height: 10px;
  min-width: 10px;
  color: var(--muted);
  opacity: 0.72;
}

.stock-out-th.is-sorted .stock-out-th__sort {
  color: var(--text-strong);
}

.stock-out-th.is-sorted .stock-out-th__sort .icon {
  color: #ea580c;
  opacity: 1;
}

html[data-theme="dark"] .stock-out-th.is-sorted .stock-out-th__sort {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .stock-out-th.is-sorted .stock-out-th__sort .icon {
  color: #fb923c;
}

.stock-out-th__resize {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 5;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.stock-out-th__resize::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 3px;
  width: 1px;
  height: calc(100% - 14px);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);
  opacity: 0;
  transition:
    opacity var(--transition),
    background var(--transition);
}

.stock-out-th:hover .stock-out-th__resize::after,
body.is-resizing-stock-out-column .stock-out-th__resize::after {
  opacity: 1;
}

html[data-theme="dark"] .stock-out-th__resize::after {
  background: rgba(255, 255, 255, 0.2);
}

body.is-resizing-stock-out-column {
  cursor: col-resize !important;
  user-select: none !important;
}

body.is-resizing-stock-out-column * {
  cursor: col-resize !important;
  user-select: none !important;
}

.stock-out-th.is-right .stock-out-th__sort {
  text-align: right;
}

.stock-out-th.is-right .stock-out-th__sort span {
  text-align: right;
}

/* =========================================================
   BADGES TABLA
   ========================================================= */

.stock-out-code,
.stock-out-status,
.stock-out-origin {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 18px;
  padding: 2px 7px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.025);
  color: var(--text-strong);
  font-size: 7.2px;
  font-weight: 950;
  line-height: 1;
}

html[data-theme="dark"] .stock-out-code,
html[data-theme="dark"] .stock-out-status,
html[data-theme="dark"] .stock-out-origin {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.88);
}

.stock-out-code {
  color: var(--muted);
}

html[data-theme="dark"] .stock-out-code {
  color: rgba(255, 255, 255, 0.46);
}

.stock-out-status::before,
.stock-out-origin::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--muted);
}

.stock-out-status.is-done::before {
  background: var(--success);
}

.stock-out-status.is-pending::before {
  background: var(--warning);
}

.stock-out-origin.is-manual::before {
  background: var(--info);
}

.stock-out-origin.is-bulk::before {
  background: var(--warning);
}

/* Cantidad sin mini-card */
.stock-out-qty {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--danger) !important;
  font-size: 9.8px !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  letter-spacing: -0.025em !important;
}

.stock-out-qty::before {
  display: none !important;
}

html[data-theme="dark"] .stock-out-qty {
  color: #f87171 !important;
}

/* =========================================================
   MODAL
   ========================================================= */

.stock-out-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.stock-out-modal.is-open {
  display: grid;
  animation: stockOutModalBackdropIn 0.16s ease both;
}

.stock-out-modal__card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(720px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--panel-solid) 98%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 20px 70px rgba(0, 0, 0, 0.24),
    0 1px 0 rgba(255, 255, 255, 0.12) inset;
  overflow: hidden;
  animation: stockOutModalIn 0.2s ease both;
}

.stock-out-modal__card--wide {
  width: min(860px, 100%);
}

html[data-theme="dark"] .stock-out-modal__card {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(10, 10, 10, 0.96);
  box-shadow:
    0 22px 80px rgba(0, 0, 0, 0.58),
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.stock-out-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .stock-out-modal__head {
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

.stock-out-modal__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stock-out-modal__icon {
  display: grid;
  width: 30px;
  height: 30px;
  min-width: 30px;
  place-items: center;
  border: 1px solid color-mix(in srgb, #ea580c 28%, rgba(0, 0, 0, 0.12));
  border-radius: 10px;
  background: color-mix(in srgb, #ea580c 6%, transparent);
  color: #ea580c;
}

html[data-theme="dark"] .stock-out-modal__icon {
  border-color: color-mix(in srgb, #fb923c 30%, rgba(255, 255, 255, 0.12));
  background: color-mix(in srgb, #fb923c 8%, transparent);
  color: #fb923c;
}

.stock-out-modal__icon .icon {
  width: 15px;
  height: 15px;
  stroke-width: 2.15;
}

.stock-out-modal__title h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 12.5px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.045em;
}

.stock-out-modal__title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 8.3px;
  font-weight: 730;
  line-height: 1.3;
}

html[data-theme="dark"] .stock-out-modal__title h3 {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .stock-out-modal__title p {
  color: rgba(255, 255, 255, 0.48);
}

.stock-out-modal__close {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  flex: 0 0 auto;
}

.stock-out-modal__body {
  display: grid;
  gap: 8px;
  min-height: 0;
  padding: 9px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 128, 145, 0.35) transparent;
}

.stock-out-modal__body::-webkit-scrollbar {
  width: 7px;
}

.stock-out-modal__body::-webkit-scrollbar-track {
  background: transparent;
}

.stock-out-modal__body::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(120, 128, 145, 0.35);
  background-clip: content-box;
}

/* =========================================================
   FORMULARIOS
   ========================================================= */

.stock-out-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  overflow: hidden;
}

html[data-theme="dark"] .stock-out-form-grid {
  border-color: rgba(255, 255, 255, 0.1);
}

.stock-out-field {
  display: grid;
  gap: 4px;
  min-height: 55px;
  padding: 8px;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: transparent;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.stock-out-field:hover {
  background: rgba(0, 0, 0, 0.035);
}

html[data-theme="dark"] .stock-out-field {
  border-right-color: rgba(255, 255, 255, 0.09);
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

html[data-theme="dark"] .stock-out-field:hover {
  background: rgba(255, 255, 255, 0.055);
}

.stock-out-field:nth-child(2n) {
  border-right: 0;
}

.stock-out-field:nth-last-child(1),
.stock-out-field:nth-last-child(2):nth-child(odd) {
  border-bottom: 0;
}

.stock-out-field--full {
  grid-column: 1 / -1;
}

.stock-out-field label {
  color: var(--muted);
  font-size: 7px;
  font-weight: 950;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

html[data-theme="dark"] .stock-out-field label {
  color: rgba(255, 255, 255, 0.48);
}

.stock-out-field input,
.stock-out-field select,
.stock-out-field textarea {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text-strong);
  outline: none;
  font-size: 9px;
  font-weight: 820;
  resize: none;
}

html[data-theme="dark"] .stock-out-field input,
html[data-theme="dark"] .stock-out-field select,
html[data-theme="dark"] .stock-out-field textarea {
  color: rgba(255, 255, 255, 0.9);
}

.stock-out-field input::placeholder,
.stock-out-field textarea::placeholder {
  color: var(--muted-2);
}

html[data-theme="dark"] .stock-out-field input::placeholder,
html[data-theme="dark"] .stock-out-field textarea::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.stock-out-field input[readonly],
.stock-out-field textarea[readonly],
.stock-out-field input:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

html[data-theme="dark"] .stock-out-field input[readonly],
html[data-theme="dark"] .stock-out-field textarea[readonly],
html[data-theme="dark"] .stock-out-field input:disabled {
  color: rgba(255, 255, 255, 0.42);
}

.stock-out-field textarea {
  min-height: 118px;
  line-height: 1.35;
}

/* =========================================================
   AYUDAS / MENSAJES
   ========================================================= */

.stock-out-help {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  background: transparent;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.stock-out-help:hover {
  background: rgba(0, 0, 0, 0.035);
}

html[data-theme="dark"] .stock-out-help {
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .stock-out-help:hover {
  background: rgba(255, 255, 255, 0.055);
}

.stock-out-help__icon {
  display: grid;
  width: 26px;
  height: 26px;
  min-width: 26px;
  place-items: center;
  border: 1px solid color-mix(in srgb, #2563eb 28%, rgba(0, 0, 0, 0.12));
  border-radius: 9px;
  background: color-mix(in srgb, #2563eb 6%, transparent);
  color: #2563eb;
}

html[data-theme="dark"] .stock-out-help__icon {
  border-color: color-mix(in srgb, #60a5fa 30%, rgba(255, 255, 255, 0.12));
  background: color-mix(in srgb, #60a5fa 8%, transparent);
  color: #60a5fa;
}

.stock-out-help__icon .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.15;
}

.stock-out-help strong {
  display: block;
  color: var(--text-strong);
  font-size: 9px;
  font-weight: 950;
  line-height: 1.1;
}

.stock-out-help p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 7.8px;
  font-weight: 720;
  line-height: 1.32;
}

.stock-out-help b {
  color: var(--text-strong);
  font-weight: 950;
}

html[data-theme="dark"] .stock-out-help strong,
html[data-theme="dark"] .stock-out-help b {
  color: rgba(255, 255, 255, 0.9);
}

html[data-theme="dark"] .stock-out-help p {
  color: rgba(255, 255, 255, 0.48);
}

/* =========================================================
   FOOTER MODAL
   ========================================================= */

.stock-out-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  padding: 9px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .stock-out-modal__footer {
  border-top-color: rgba(255, 255, 255, 0.09);
}

/* =========================================================
   TOAST
   ========================================================= */

.stock-out-toast {
  position: fixed;
  right: 14px;
  bottom: 38px;
  z-index: 10000;
  max-width: min(360px, calc(100vw - 28px));
  padding: 9px 11px;
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-solid) 98%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text-strong);
  font-size: 8.6px;
  font-weight: 900;
  line-height: 1.25;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.12) inset;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
  transition:
    opacity var(--transition),
    transform var(--transition),
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.stock-out-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

html[data-theme="dark"] .stock-out-toast {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(10, 10, 10, 0.96);
  color: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 22px 64px rgba(0, 0, 0, 0.58),
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1380px) {
  .stock-out-head {
    grid-template-columns: 1fr;
  }

  .stock-out-actions {
    justify-content: flex-start;
  }

  .stock-out-toolbar {
    grid-template-columns: 1fr;
  }

  .stock-out-filters {
    justify-content: flex-start;
  }
}

@media (max-width: 1100px) {
  .stock-out-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stock-out-metric:nth-child(3n) {
    border-right: 0;
  }

  .stock-out-metric:nth-child(n + 4) {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  html[data-theme="dark"] .stock-out-metric:nth-child(n + 4) {
    border-top-color: rgba(255, 255, 255, 0.09);
  }
}

@media (max-width: 820px) {
  .stock-out-page {
    gap: 6px;
  }

  .stock-out-head {
    padding: 7px;
  }

  .stock-out-actions,
  .stock-out-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .stock-out-search {
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
  }

  .stock-out-btn,
  .stock-out-filters select {
    width: 100%;
  }

  .stock-out-table {
    min-width: 1080px;
  }

  .stock-out-modal {
    padding: 10px;
  }

  .stock-out-modal__card {
    max-height: calc(100vh - 20px);
  }
}

@media (max-width: 620px) {
  .stock-out-brand {
    align-items: flex-start;
  }

  .stock-out-brand p {
    font-size: 8.2px;
  }

  .stock-out-actions,
  .stock-out-filters {
    grid-template-columns: 1fr;
  }

  .stock-out-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-out-metric {
    min-height: 50px;
    padding: 8px 9px;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  .stock-out-metric strong {
    font-size: 15px;
  }

  .stock-out-metric:nth-child(1),
  .stock-out-metric:nth-child(2) {
    border-top: 0;
  }

  .stock-out-metric:nth-child(2n) {
    border-right: 0;
  }

  html[data-theme="dark"] .stock-out-metric {
    border-right-color: rgba(255, 255, 255, 0.09);
    border-top-color: rgba(255, 255, 255, 0.09);
  }

  .stock-out-form-grid {
    grid-template-columns: 1fr;
  }

  .stock-out-field {
    border-right: 0;
  }

  .stock-out-field:nth-child(2n) {
    border-right: 0;
  }

  .stock-out-field:nth-last-child(2):nth-child(odd) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  html[data-theme="dark"] .stock-out-field:nth-last-child(2):nth-child(odd) {
    border-bottom-color: rgba(255, 255, 255, 0.09);
  }

  .stock-out-modal__footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .stock-out-modal__footer .stock-out-btn {
    width: 100%;
  }

  .stock-out-help {
    grid-template-columns: 1fr;
  }

  .stock-out-help__icon {
    width: 25px;
    height: 25px;
    min-width: 25px;
  }
}

@media (max-width: 420px) {
  .stock-out-head,
  .stock-out-panel,
  .stock-out-metrics {
    border-radius: 12px;
  }

  .stock-out-brand__icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }

  .stock-out-brand h2 {
    font-size: 12.5px;
  }

  .stock-out-brand p {
    display: none;
  }

  .stock-out-metrics {
    grid-template-columns: 1fr;
  }

  .stock-out-metric {
    border-right: 0;
  }

  .stock-out-metric:nth-child(2) {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  html[data-theme="dark"] .stock-out-metric:nth-child(2) {
    border-top-color: rgba(255, 255, 255, 0.09);
  }

  .stock-out-toolbar {
    padding: 6px;
  }

  .stock-out-table {
    min-width: 1020px;
  }

  .stock-out-modal__head {
    align-items: flex-start;
  }

  .stock-out-modal__title p {
    display: none;
  }

  .stock-out-toast {
    right: 10px;
    bottom: 34px;
    max-width: calc(100vw - 20px);
  }
}

/* =========================================================
   ANIMACIONES
   ========================================================= */

@keyframes stockOutPageIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes stockOutModalBackdropIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes stockOutModalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Respeta usuarios con reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  .stock-out-page,
  .stock-out-page *,
  .stock-out-page *::before,
  .stock-out-page *::after,
  .stock-out-modal,
  .stock-out-modal *,
  .stock-out-modal *::before,
  .stock-out-modal *::after,
  .stock-out-toast {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   EGRESOS STOCK · SIN BARRA HORIZONTAL
   La tabla se adapta al ancho disponible
   ========================================================= */

.stock-out-table-wrap {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.stock-out-table {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed !important;
}

/* Anchos proporcionales para que entre todo sin scroll horizontal */
.stock-out-table th:nth-child(1),
.stock-out-table td:nth-child(1) {
  width: 7%;
}

.stock-out-table th:nth-child(2),
.stock-out-table td:nth-child(2) {
  width: 10%;
}

.stock-out-table th:nth-child(3),
.stock-out-table td:nth-child(3) {
  width: 8%;
}

.stock-out-table th:nth-child(4),
.stock-out-table td:nth-child(4) {
  width: 19%;
}

.stock-out-table th:nth-child(5),
.stock-out-table td:nth-child(5) {
  width: 7%;
}

.stock-out-table th:nth-child(6),
.stock-out-table td:nth-child(6) {
  width: 10%;
}

.stock-out-table th:nth-child(7),
.stock-out-table td:nth-child(7) {
  width: 8%;
}

.stock-out-table th:nth-child(8),
.stock-out-table td:nth-child(8) {
  width: 8%;
}

.stock-out-table th:nth-child(9),
.stock-out-table td:nth-child(9) {
  width: 8%;
}

.stock-out-table th:nth-child(10),
.stock-out-table td:nth-child(10) {
  width: 7%;
}

.stock-out-table th:nth-child(11),
.stock-out-table td:nth-child(11) {
  width: 8%;
}

/* Texto compacto para que no empuje la tabla */
.stock-out-table th,
.stock-out-table td {
  min-width: 0 !important;
  max-width: none !important;
  padding-left: 8px !important;
  padding-right: 9px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Producto y observación se cortan limpio */
.stock-out-table td:nth-child(4),
.stock-out-table td:nth-child(11) {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* En pantallas chicas se compacta más, pero sin barra horizontal */
@media (max-width: 820px) {
  .stock-out-table {
    min-width: 0 !important;
    width: 100% !important;
  }

  .stock-out-table th,
  .stock-out-table td {
    padding-left: 6px !important;
    padding-right: 7px !important;
    font-size: 7.6px !important;
  }

  .stock-out-th__sort .icon {
    display: none !important;
  }

  .stock-out-code,
  .stock-out-status,
  .stock-out-origin {
    padding: 1px 4px !important;
    font-size: 6.9px !important;
  }

  .stock-out-qty {
    font-size: 8.6px !important;
  }
}

@media (max-width: 620px) {
  .stock-out-table th,
  .stock-out-table td {
    padding-left: 4px !important;
    padding-right: 5px !important;
    font-size: 7px !important;
  }

  .stock-out-table th {
    font-size: 6.2px !important;
  }

  .stock-out-code,
  .stock-out-status,
  .stock-out-origin {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }
}