/* ════════════════════════════════════════════════════════════════════
   PEUNEX — Inventario: formato del catálogo (tarjetas / tabla).
   Aditivo a panel-pages.css: reutiliza .product-grid, .product-card,
   .product-card__img/__body/__name/__meta/__foot/__price y .status-pill.
   Solo usa los tokens existentes --primary, --primary-light, --surface,
   --surface-hover, --border, --text, --text-muted, --success, --danger
   y --warning. Sin colores nuevos. Responsive de 360 px a escritorio.
   ════════════════════════════════════════════════════════════════════ */

/* ── Interruptor de vista: Tarjetas | Tabla ───────────────────────── */
.inv-view-switch {
  display: inline-flex;
  align-items: stretch;
  gap: .125rem;
  padding: .15rem;
  border: 1px solid var(--border);
  border-radius: .65rem;
  background: var(--surface-hover);
}

.inv-view-switch__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0 .7rem;
  border: 0;
  border-radius: .5rem;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: .8rem;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.inv-view-switch__btn i {
  font-size: 1rem;
}

.inv-view-switch__btn:hover {
  color: var(--text);
}

.inv-view-switch__btn.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 18%, transparent);
}

.inv-view-switch__btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* ── Cuadrícula de tarjetas del inventario ────────────────────────── */
.inv-product-grid {
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: .875rem;
  padding: 1rem;
}

.inv-product-card {
  position: relative;
  transition: border-color .16s ease;
}

.inv-product-card:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}

.inv-product-card--inactive {
  opacity: .6;
}

/* Imagen + selector masivo superpuesto */
.inv-card-media {
  position: relative;
}

.inv-card-media__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-muted);
  font-size: clamp(1.4rem, 4vw, 2rem);
}

.inv-card-type-badge {
  position: absolute;
  top: .45rem;
  right: .45rem;
  z-index: 2;
  padding: .12rem .4rem;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.3;
  pointer-events: none;
}

.inv-card-type-badge.is-product {
  background: color-mix(in srgb, var(--text-muted) 14%, var(--surface));
  color: var(--text-muted);
}

.inv-card-type-badge.is-service {
  background: color-mix(in srgb, var(--info, #0284c7) 14%, var(--surface));
  color: var(--info, #0284c7);
}

.inv-product-card .product-card__name {
  min-height: 0;
}

.inv-product-card .product-card__body {
  gap: .22rem;
}

.inv-card-select {
  position: absolute;
  top: .45rem;
  left: .45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: .45rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  cursor: pointer;
}

.inv-card-select input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Meta: SKU + categoría */
.inv-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem .45rem;
  min-width: 0;
}

.inv-card-meta > span {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  min-width: 0;
  max-width: 100%;
}

.inv-card-code {
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-card-category {
  overflow: hidden;
  padding: .05rem .35rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-card-brandline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .2rem .3rem;
  margin-top: 0;
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.inv-card-brandline .inv-card-brand {
  color: var(--text-muted);
  font-weight: 700;
}

.inv-card-model {
  overflow: hidden;
  color: var(--text-muted);
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-card-expiry {
  padding: .05rem .35rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--warning) 13%, transparent);
  color: var(--warning);
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
}

.inv-card-media-link {
  display: block;
  width: 100%;
  height: 100%;
}

.inv-card-media-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Precio y pie de tarjeta */
.inv-product-card .product-card__foot {
  flex-wrap: wrap;
  align-items: center;
}

.inv-card-price-old {
  display: block;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 500;
  text-decoration: line-through;
}

/* Fila de acciones de la tarjeta */
.inv-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  margin-top: .55rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
}

.inv-card-actions form {
  display: contents;
  margin: 0;
}

.inv-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: .95rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.inv-card-action:hover:not(.is-disabled) {
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  color: var(--text);
}

.inv-card-action:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.inv-card-action--danger {
  color: var(--danger);
}

.inv-card-action--danger:hover:not(.is-disabled) {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  color: var(--danger);
}

.inv-card-action.is-disabled {
  opacity: .4;
  cursor: not-allowed;
}

.inv-card-web {
  display: inline-flex;
}

/* El interruptor web conserva su comportamiento; en tarjeta usa 36 px. */
.inv-card-actions .inv-web-toggle {
  width: 36px;
  height: 36px;
  font-size: .95rem;
}

.inv-card-actions .inv-web-toggle[aria-pressed="true"] {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--primary);
}

.inv-product-grid__empty {
  grid-column: 1 / -1;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .inv-view-switch {
    display: flex;
    width: 100%;
  }

  .inv-view-switch__btn {
    flex: 1 1 0;
    min-height: 44px;
  }
}

@media (max-width: 640px) {
  .inv-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: .625rem;
    padding: .75rem;
  }
}

@media (max-width: 380px) {
  .inv-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
  }

  .inv-product-card .product-card__body {
    padding: .5rem;
  }

  .inv-product-card .product-card__price {
    font-size: .8rem;
  }
}

@media (pointer: coarse) {
  .inv-card-action,
  .inv-card-actions .inv-web-toggle {
    width: 44px;
    height: 44px;
  }

  .inv-card-select {
    width: 44px;
    height: 44px;
  }

  .inv-card-select input {
    width: 1.15rem;
    height: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .inv-product-card,
  .inv-view-switch__btn,
  .inv-card-action {
    transition: none;
  }
}

/* ── Resumen compacto (etiqueta + valor en una línea) ─────────────── */
.inv-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: .5rem;
  margin-bottom: .75rem;
}

.inv-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  min-width: 0;
  padding: .45rem .75rem;
  border: 1px solid var(--border);
  border-radius: .6rem;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

a.inv-stat:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  background: var(--surface-hover);
}

.inv-stat__label {
  overflow: hidden;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.inv-stat__value {
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.inv-stat__value--accent { color: var(--primary); }
.inv-stat__value--info { color: #0ea5e9; }
.inv-stat__value--ok { color: var(--success); }
.inv-stat__value--warn { color: var(--warning); }
.inv-stat__value--danger { color: var(--danger); }

@media (max-width: 640px) {
  .inv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
  .inv-stat { padding: .35rem .6rem; }
  .inv-stat__value { font-size: .95rem; }
}

/* ── Acciones de tarjeta: una sola fila compacta ──────────────────── */
.inv-card-actions {
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 2px;
  margin-top: .4rem;
  padding-top: .4rem;
}

.inv-card-action,
.inv-card-actions .inv-web-toggle {
  width: 28px;
  height: 28px;
  font-size: .8rem;
  border-radius: .4rem;
}

@media (pointer: coarse) {
  .inv-card-action,
  .inv-card-actions .inv-web-toggle {
    width: 30px;
    height: 30px;
  }
}

/* Tarjeta más baja: imagen panorámica y cuerpo ajustado */
.inv-product-card .inv-card-media { aspect-ratio: 16 / 10; }
.inv-product-card .product-card__body { padding: .5rem .6rem .55rem; gap: .25rem; }
.inv-product-grid { gap: .6rem; padding: .75rem; }
@media (max-width: 640px) {
  .inv-product-card .inv-card-media { aspect-ratio: 16 / 9; }
  .inv-product-grid { gap: .45rem; padding: .5rem; }
}

