/* =========================================================
   WIRTZ HUB · EVENTOS · COMPRAS
   Abastecimiento · PO · stock · cobertura · pedido sugerido
   Premium · minimalista · responsive · dark safe
   Orden dinámico · columnas ocultables · mobile card safe
   ========================================================= */

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

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

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

.purchases-head,
.purchases-metrics,
.purchases-panel,
.purchases-insight {
  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"] .purchases-head,
html[data-theme="dark"] .purchases-metrics,
html[data-theme="dark"] .purchases-panel,
html[data-theme="dark"] .purchases-insight {
  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
   ========================================================= */

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

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

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

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

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

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

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

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

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

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

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

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

.purchases-btn,
.purchases-action {
  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);
}

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

.purchases-btn:active,
.purchases-action:active {
  transform: scale(0.98);
}

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

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

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

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

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

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

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

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

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

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

.purchases-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);
}

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

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

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

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

.purchases-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;
}

.purchases-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;
}

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

.purchases-metric:nth-child(1) strong {
  color: #047857;
}

.purchases-metric:nth-child(2) strong {
  color: #2563eb;
}

.purchases-metric:nth-child(3) strong {
  color: #7c3aed;
}

.purchases-metric:nth-child(4) strong {
  color: #ca8a04;
}

.purchases-metric:nth-child(5) strong {
  color: #dc2626;
}

.purchases-metric:nth-child(6) strong {
  color: #0891b2;
}

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

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

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

/* =========================================================
   INSIGHT
   ========================================================= */

.purchases-insight {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px;
}

.purchases-insight__main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.purchases-insight__icon {
  display: grid;
  width: 27px;
  height: 27px;
  min-width: 27px;
  place-items: center;
  border: 1px solid color-mix(in srgb, #047857 30%, rgba(0, 0, 0, 0.12));
  border-radius: 9px;
  background: color-mix(in srgb, #047857 7%, transparent);
  color: #047857;
}

.purchases-insight__icon .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.15;
}

.purchases-insight strong {
  display: block;
  margin: 0 0 2px;
  color: var(--text-strong);
  font-size: 10px;
  font-weight: 950;
  line-height: 1.1;
}

.purchases-insight span {
  display: block;
  color: var(--muted);
  font-size: 8px;
  font-weight: 780;
  line-height: 1.25;
}

.purchases-insight__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(0, 0, 0, 0.11);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.025);
  color: var(--text-strong);
  font-size: 7.4px;
  font-weight: 950;
  white-space: nowrap;
}

html[data-theme="dark"] .purchases-insight__icon {
  border-color: color-mix(in srgb, #34d399 30%, rgba(255, 255, 255, 0.12));
  background: color-mix(in srgb, #34d399 8%, transparent);
  color: #34d399;
}

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

html[data-theme="dark"] .purchases-insight span {
  color: rgba(255, 255, 255, 0.46);
}

html[data-theme="dark"] .purchases-insight__pill {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.86);
}

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

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

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

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

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

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

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

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

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

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

.purchases-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);
}

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

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

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

.purchases-search .icon {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  stroke-width: 2.15;
  color: #047857;
}

html[data-theme="dark"] .purchases-search .icon {
  color: #34d399;
}

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

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

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

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

.purchases-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);
}

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

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

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

/* =========================================================
   MENÚ COLUMNAS
   ========================================================= */

.purchases-columns-menu {
  position: relative;
  display: inline-flex;
  min-width: 0;
}

.purchases-columns-menu summary {
  list-style: none;
}

.purchases-columns-menu summary::-webkit-details-marker {
  display: none;
}

.purchases-columns-menu > summary.purchases-btn {
  min-height: 28px;
}

.purchases-columns-menu__panel {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 80;
  display: grid;
  gap: 3px;
  width: 180px;
  max-height: min(320px, calc(100vh - 180px));
  padding: 7px;
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-solid) 99%, transparent);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.035),
    0 18px 42px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow-y: auto;
  animation: purchasesColumnsIn 0.16s ease both;
}

html[data-theme="dark"] .purchases-columns-menu__panel {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(12, 12, 12, 0.96);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03),
    0 18px 42px rgba(0, 0, 0, 0.38);
}

.purchases-column-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  padding: 4px 5px;
  border-radius: 8px;
  color: var(--text-strong);
  font-size: 8px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition:
    background var(--transition),
    color var(--transition);
}

.purchases-column-option:hover {
  background: rgba(0, 0, 0, 0.055);
}

html[data-theme="dark"] .purchases-column-option {
  color: rgba(255, 255, 255, 0.86);
}

html[data-theme="dark"] .purchases-column-option:hover {
  background: rgba(255, 255, 255, 0.075);
}

.purchases-column-option input {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: #047857;
  cursor: pointer;
}

html[data-theme="dark"] .purchases-column-option input {
  accent-color: #34d399;
}

.purchases-column-option span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.purchases-columns-menu__panel > .purchases-btn {
  width: 100%;
  margin-top: 4px;
}

/* =========================================================
   LISTAS DOBLES
   ========================================================= */

.purchases-lists {
  display: grid;
  gap: 8px;
  padding: 7px;
}

.purchases-list-panel {
  display: grid;
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.105);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.015);
  overflow: hidden;
}

html[data-theme="dark"] .purchases-list-panel {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.025);
}

.purchases-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.095);
  background: color-mix(in srgb, #047857 4%, transparent);
}

html[data-theme="dark"] .purchases-list-head {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  background: color-mix(in srgb, #34d399 5%, transparent);
}

.purchases-list-head__title {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.purchases-list-head__title strong {
  color: var(--text-strong);
  font-size: 10px;
  font-weight: 950;
  line-height: 1.1;
}

.purchases-list-head__title span {
  color: var(--muted);
  font-size: 7px;
  font-weight: 850;
  line-height: 1.1;
}

.purchases-list-head__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 3px 8px;
  border: 1px solid rgba(0, 0, 0, 0.105);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-solid) 92%, transparent);
  color: var(--text-strong);
  font-size: 7px;
  font-weight: 950;
  white-space: nowrap;
}

html[data-theme="dark"] .purchases-list-head__title strong {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .purchases-list-head__title span {
  color: rgba(255, 255, 255, 0.46);
}

html[data-theme="dark"] .purchases-list-head__pill {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.86);
}

/* =========================================================
   TABLAS SIN SCROLL HORIZONTAL
   ========================================================= */

.purchases-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
}

.purchases-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: transparent;
}

.purchases-table th,
.purchases-table td {
  position: relative;
  height: 30px;
  padding: 0 6px !important;
  border-right: 0 !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.085);
  box-shadow: none !important;
  color: var(--text);
  font-size: 8px;
  font-weight: 720;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.purchases-table th {
  background: color-mix(in srgb, var(--panel-solid) 98%, transparent);
  color: var(--muted);
  font-size: 6.45px;
  font-weight: 950;
  letter-spacing: 0.06em;
  line-height: 1.05;
  text-transform: uppercase;
}

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

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

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

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

.purchases-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.04);
}

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

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

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

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

.purchases-table td.is-number,
.purchases-table th.is-number {
  text-align: right !important;
}

.purchases-table td.is-center,
.purchases-table th.is-center {
  text-align: center !important;
}

.purchases-table .col-provider {
  width: 7%;
}

.purchases-table .col-img {
  width: 4%;
}

.purchases-table .col-sku {
  width: 8%;
}

.purchases-table .col-name {
  width: 22%;
}

.purchases-table .col-stock {
  width: 6%;
}

.purchases-table .col-vpm {
  width: 6%;
}

.purchases-table .col-months {
  width: 6%;
}

.purchases-table .col-po {
  width: 6%;
}

.purchases-table .col-transit {
  width: 7%;
}

.purchases-table .col-coverage {
  width: 8%;
}

.purchases-table .col-overstock {
  width: 7%;
}

.purchases-table .col-order {
  width: 7%;
}

.purchases-table .col-alert {
  width: 6%;
}

/* =========================================================
   BADGES Y VALORES
   ========================================================= */

.purchases-provider,
.purchases-sku,
.purchases-image-flag,
.purchases-alert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 17px;
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.018);
  color: var(--text-strong);
  font-size: 6.8px;
  font-weight: 950;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.purchases-provider {
  color: #047857;
}

.purchases-sku {
  color: var(--text-strong);
}

.purchases-image-flag {
  min-width: 24px;
  color: var(--muted);
}

.purchases-value {
  display: inline-flex;
  justify-content: flex-end;
  min-width: 18px;
  color: var(--text-strong);
  font-size: 8.1px;
  font-weight: 850;
  line-height: 1;
}

.purchases-value.is-red {
  color: #b91c1c;
  font-weight: 950;
}

.purchases-value.is-muted {
  color: var(--muted-2);
  font-weight: 800;
}

.purchases-value.is-strong {
  font-weight: 950;
}

.purchases-value.is-order {
  color: #111827;
  font-weight: 950;
}

.purchases-alert {
  border: 0;
  background: transparent;
  padding: 0;
  min-height: auto;
  color: #047857;
  font-size: 7.2px;
}

.purchases-alert.is-ok {
  color: #047857;
}

.purchases-alert.is-warning {
  color: #b45309;
}

.purchases-alert.is-danger {
  color: #dc2626;
}

html[data-theme="dark"] .purchases-provider,
html[data-theme="dark"] .purchases-sku,
html[data-theme="dark"] .purchases-image-flag {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.88);
}

html[data-theme="dark"] .purchases-provider {
  color: #34d399;
}

html[data-theme="dark"] .purchases-value {
  color: rgba(255, 255, 255, 0.88);
}

html[data-theme="dark"] .purchases-value.is-red {
  color: #f87171;
}

html[data-theme="dark"] .purchases-value.is-muted {
  color: rgba(255, 255, 255, 0.34);
}

html[data-theme="dark"] .purchases-value.is-order {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .purchases-alert {
  color: #34d399;
}

html[data-theme="dark"] .purchases-alert.is-ok {
  color: #34d399;
}

html[data-theme="dark"] .purchases-alert.is-warning {
  color: #fbbf24;
}

html[data-theme="dark"] .purchases-alert.is-danger {
  color: #f87171;
}

/* =========================================================
   MOBILE CARDS
   ========================================================= */

.purchases-cards {
  display: none;
  gap: 6px;
  padding: 7px;
}

.purchases-card {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(0, 0, 0, 0.11);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.018);
}

.purchases-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.purchases-card__title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.purchases-card__title strong {
  color: var(--text-strong);
  font-size: 10px;
  font-weight: 950;
  line-height: 1.1;
}

.purchases-card__title span {
  color: var(--muted);
  font-size: 7.4px;
  font-weight: 880;
  line-height: 1.15;
}

.purchases-card__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.purchases-card__grid div {
  display: grid;
  gap: 2px;
  min-height: 34px;
  padding: 6px;
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.28);
}

.purchases-card__grid span {
  color: var(--muted);
  font-size: 6.8px;
  font-weight: 950;
  letter-spacing: 0.07em;
  line-height: 1;
  text-transform: uppercase;
}

.purchases-card__grid strong {
  color: var(--text-strong);
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
}

html[data-theme="dark"] .purchases-card {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
}

html[data-theme="dark"] .purchases-card__grid div {
  border-color: rgba(255, 255, 255, 0.085);
  background: rgba(255, 255, 255, 0.035);
}

html[data-theme="dark"] .purchases-card__title strong,
html[data-theme="dark"] .purchases-card__grid strong {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .purchases-card__title span,
html[data-theme="dark"] .purchases-card__grid span {
  color: rgba(255, 255, 255, 0.46);
}

/* =========================================================
   EMPTY
   ========================================================= */

.purchases-empty {
  display: grid;
  place-items: center;
  min-height: 80px;
  padding: 12px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 850;
  text-align: center;
}

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

.purchases-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  max-width: min(360px, calc(100vw - 36px));
  padding: 9px 11px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 13px;
  background: color-mix(in srgb, var(--panel-solid) 98%, transparent);
  color: var(--text-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 8.7px;
  font-weight: 900;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity var(--transition),
    transform var(--transition);
}

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

html[data-theme="dark"] .purchases-toast {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(12, 12, 12, 0.94);
  color: rgba(255, 255, 255, 0.9);
}

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

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

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

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

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

@media (max-width: 980px) {
  .purchases-page {
    gap: 7px;
    min-height: auto;
  }

  .purchases-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .purchases-actions {
    justify-content: flex-start;
  }

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

  .purchases-filters {
    justify-content: flex-start;
  }

  .purchases-table-wrap {
    display: none;
  }

  .purchases-cards {
    display: grid;
  }

  .purchases-columns-menu {
    width: 100%;
    display: grid;
  }

  .purchases-columns-menu > summary.purchases-btn {
    width: 100%;
  }

  .purchases-columns-menu__panel {
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 5px;
    box-shadow: none;
  }
}

@media (max-width: 720px) {
  .purchases-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchases-metric {
    border-right: 1px solid rgba(0, 0, 0, 0.1);
  }

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

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

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

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

  .purchases-insight {
    grid-template-columns: 1fr;
  }

  .purchases-insight__pill {
    justify-self: start;
  }
}

@media (max-width: 620px) {
  .purchases-head,
  .purchases-panel,
  .purchases-insight,
  .purchases-metrics {
    border-radius: 15px;
  }

  .purchases-brand {
    align-items: flex-start;
  }

  .purchases-actions,
  .purchases-filters {
    width: 100%;
  }

  .purchases-btn,
  .purchases-action,
  .purchases-filters select,
  .purchases-search {
    width: 100%;
  }

  .purchases-search {
    min-width: 0;
  }

  .purchases-card__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .purchases-metrics {
    grid-template-columns: 1fr;
  }

  .purchases-metric {
    border-right: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }

  .purchases-metric:first-child {
    border-top: 0;
  }

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

  .purchases-card__grid {
    grid-template-columns: 1fr;
  }
}

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

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

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

@keyframes purchasesColumnsIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.985);
  }

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