/* ═══════════════════════════════════════════════════════════════
   Tarjeta v2 de Catálogo de Productos (DS Dropshipping) — 27/09/2026
   Rediseño pedido explícito ("card ideal" provista por el usuario):
   cabecera horizontal, 3 cifras arriba y secciones plegables
   (Financiación / Packs / Costos de venta). Archivo aparte a propósito:
   se carga DESPUÉS de analista-productos.css y sólo pisa lo necesario
   bajo .ap-pf-card-v2 — la tarjeta vieja y el resto del módulo no se
   tocan. Usa los tokens --ap-* (claro/oscuro salen solos).
   ═══════════════════════════════════════════════════════════════ */

#page-analista_productos .ap-pf-grid:has(.ap-pf-card-v2) {
  grid-template-columns: repeat(auto-fill, minmax(360px, 400px));
  align-items: start;
  gap: 20px;
}

#page-analista_productos .ap-pf-card.ap-pf-card-v2 {
  height: auto;
  border-radius: 18px;
  padding: 14px 14px 0;
  gap: 12px;
  overflow: hidden;
}
#page-analista_productos .ap-pf-card.ap-pf-card-v2:hover { transform: translateY(-2px); }

/* ── Fila superior: casilla · estado ML · favorito ── */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-top {
  display: flex; align-items: center; gap: 8px; min-height: 28px;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-select { display: flex; cursor: pointer; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-select input {
  width: 17px; height: 17px; cursor: pointer; accent-color: var(--ap-blue);
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-ml-badges-row {
  position: static; transform: none; margin-left: auto;
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-fav-star {
  position: static; background: transparent; color: var(--ap-text2); width: 28px; height: 28px;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-fav-star.active { color: #fbbf24; }

/* Badges de ML como píldoras compactas (en la v1 son círculos grandes
   flotando sobre la foto). */
#page-analista_productos .ap-pf-card-v2 .ap-pf-ml-badge {
  width: auto; height: 26px; padding: 0 11px; border-radius: 999px;
  flex-direction: row; gap: 6px; box-shadow: none; font-size: 10.5px;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-ml-badge .ap-pf-ml-badge-label {
  font-size: 10.5px; text-transform: none; letter-spacing: 0; opacity: 1; font-weight: 700;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-ml-badge-text { flex-direction: row; gap: 6px; align-items: center; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-ml-badge-price { font-size: 10.5px; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-ml-badge-unpublished {
  display: inline-flex; align-items: center;
  background: rgba(99,102,241,.14); color: #6366f1;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-ml-badge-unpublished::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}

/* ── Cabecera: foto + identidad ── */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-head {
  display: grid; grid-template-columns: 124px 1fr; gap: 14px; align-items: start;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-img {
  height: 124px; width: 124px; margin: 0; border-radius: 14px;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-img img { object-fit: contain; background: var(--ap-bg); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-info {
  display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-top: 2px;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sku {
  font-size: 11px; font-weight: 600; color: var(--ap-text2); font-family: ui-monospace, monospace;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-title {
  font-size: 17px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em;
  white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-meta { font-size: 12px; color: var(--ap-text2); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-prov {
  font-size: 10.5px; color: var(--ap-text2); opacity: .75;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-badge-row { justify-content: flex-start; margin-top: 6px; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-stock-badge { font-size: 10px; padding: 4px 10px; }

/* ── Las 3 cifras ── */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-kpis {
  display: grid; grid-template-columns: 1fr 1fr 1.15fr;
  border: 1px solid var(--ap-border); border-radius: 14px; overflow: hidden;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-kpi {
  display: flex; flex-direction: column; gap: 4px; padding: 11px 12px; min-width: 0;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-kpi + .ap-pf-v2-kpi { border-left: 1px solid var(--ap-border); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-kpi-lbl { font-size: 11px; color: var(--ap-text2); font-weight: 600; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-kpi-val {
  font-size: 17px; font-weight: 800; color: var(--ap-text); letter-spacing: -.02em; white-space: nowrap;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-kpi-win { background: rgba(16,185,129,.1); border-left-color: transparent !important; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-kpi-win .ap-pf-v2-kpi-lbl { color: #059669; font-weight: 700; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-gan {
  display: flex; align-items: baseline; gap: 2px; font-size: 17px; font-weight: 800; color: #059669;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-gan .ap-pf-ganancia-input {
  border: none; background: transparent; padding: 0; text-align: left;
  font-size: 17px; font-weight: 800; color: #059669; width: 100%; min-width: 0;
  border-bottom: 1px dashed transparent; border-radius: 0;
  -moz-appearance: textfield;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-gan .ap-pf-ganancia-input::-webkit-inner-spin-button,
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-gan .ap-pf-ganancia-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-gan .ap-pf-ganancia-input:hover,
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-gan .ap-pf-ganancia-input:focus { border-bottom-color: #059669; outline: none; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-margin {
  align-self: flex-start; font-size: 10px; font-weight: 700; color: #059669;
  background: rgba(16,185,129,.14); border: 1px solid rgba(16,185,129,.3);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}

/* ── Secciones plegables ── */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-secs { display: flex; flex-direction: column; gap: 10px; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sec {
  border: 1px solid var(--ap-border); border-radius: 14px; background: var(--ap-bg);
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sec-head {
  display: flex; align-items: center; gap: 8px; padding: 11px 12px;
  cursor: pointer; list-style: none; user-select: none;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sec-head::-webkit-details-marker { display: none; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sec-icon { font-size: 14px; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sec-title { font-size: 13px; font-weight: 800; color: var(--ap-text); white-space: nowrap; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sec-sum {
  margin-left: auto; font-size: 11px; color: var(--ap-text2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
/* El resumen sólo hace falta cerrado — abierto ya se ve el detalle. */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sec[open] .ap-pf-v2-sec-sum { visibility: hidden; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sec-chev {
  width: 8px; height: 8px; flex-shrink: 0; margin-left: 4px;
  border-right: 2px solid var(--ap-text2); border-bottom: 2px solid var(--ap-text2);
  transform: rotate(45deg) translateY(-2px); transition: transform 180ms var(--ap-ease);
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sec[open] .ap-pf-v2-sec-chev { transform: rotate(-135deg) translateY(-2px); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sec-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }

/* Segmentado de cuotas */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-seg-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-seg {
  padding: 7px 4px; border-radius: 9px; border: 1px solid var(--ap-border); background: var(--ap-card);
  color: var(--ap-text2); font-size: 11px; font-weight: 600; cursor: pointer;
  transition: background 150ms var(--ap-ease), color 150ms var(--ap-ease);
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-seg:hover { border-color: #6366f1; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-seg.active {
  background: #6366f1; border-color: #6366f1; color: #fff; box-shadow: 0 4px 12px rgba(99,102,241,.3);
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-received {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 11px; border-radius: 10px; background: var(--ap-card); border: 1px solid var(--ap-border);
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-received-lbl { font-size: 12px; color: var(--ap-text2); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-received strong { font-size: 14px; color: var(--ap-text); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-received-sub,
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-note { font-size: 10.5px; color: var(--ap-text2); line-height: 1.45; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-fin-publish select { width: 100%; }

/* Interruptor de packs */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-switch { position: relative; width: 32px; height: 18px; flex-shrink: 0; cursor: pointer; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-switch span {
  position: absolute; inset: 0; border-radius: 999px; background: rgba(148,163,184,.45); transition: background 150ms var(--ap-ease);
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-switch span::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 150ms var(--ap-ease);
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-switch input:checked + span { background: #6366f1; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-switch input:checked + span::after { transform: translateX(14px); }

/* Chips de packs */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-chip-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-chip {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px;
  border-radius: 10px; border: 1px solid var(--ap-border); background: var(--ap-card); color: var(--ap-text); cursor: pointer;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-chip strong { font-size: 12px; font-weight: 700; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-chip small { font-size: 9.5px; color: var(--ap-text2); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-chip.active { border-color: #6366f1; background: rgba(99,102,241,.1); color: #4f46e5; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-chip-row.is-off .ap-pf-v2-chip { opacity: .45; cursor: default; }

/* Filas de costos */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-rows { display: flex; flex-direction: column; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 0; font-size: 12px; color: var(--ap-text);
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-row + .ap-pf-v2-row { border-top: 1px solid var(--ap-border); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-row > span:first-child { display: flex; align-items: center; gap: 6px; color: var(--ap-text2); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-row input[type="checkbox"] { accent-color: var(--ap-blue); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-row-input { display: flex; align-items: center; gap: 4px; color: var(--ap-text2); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-row-input .ap-pf-mini-input { width: 84px; text-align: right; font-size: 12px; padding: 5px 8px; }

/* ── Acciones: publicar amarillo ML de ancho completo ── */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-actions {
  display: flex; flex-direction: column; gap: 8px; margin: 2px -14px 0; padding: 0 14px 14px;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-publish-flush {
  position: static; width: 100%; margin: 0; border-radius: 12px; height: 44px;
  background: #FFE600; color: #1a1a1a; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-publish-flush svg { width: 16px; height: 16px; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-envio-gratis-btn { width: 100%; border-radius: 10px; }

/* ── Ajustes tras la primera prueba en pantalla ── */
/* Cifras: "$ 4.700" grande con ",00" chico (como el mockup) — sin "AR$"
   las tres entran en una sola línea. */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-kpi-val,
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-gan { font-size: 18px; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-cur { margin-right: 3px; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-dec { font-size: 11px; font-weight: 700; margin-left: 1px; vertical-align: 5px; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-gan .ap-pf-ganancia-input { font-size: 18px; }

/* Casilla de selección propia (la nativa se veía como un cuadrado negro). */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-select input {
  -webkit-appearance: none; appearance: none; margin: 0;
  width: 18px; height: 18px; border-radius: 5px; background: var(--ap-card);
  border: 1.5px solid rgba(100,116,139,.55); display: grid; place-content: center;
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-select input:checked { background: #6366f1; border-color: #6366f1; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-select input:checked::after {
  content: ''; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px);
}

/* Chips de estado suaves (tinte + texto de color) en vez de sólidos. */
#page-analista_productos .ap-pf-card-v2 .ap-pf-stock-badge { border: 1px solid transparent; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-stock-ok      { background: rgba(22,163,74,.1);  color: #15803d; border-color: rgba(22,163,74,.25); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-stock-low     { background: rgba(245,158,11,.12); color: #b45309; border-color: rgba(245,158,11,.3); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-stock-out     { background: rgba(239,68,68,.1);  color: #dc2626; border-color: rgba(239,68,68,.25); }
#page-analista_productos .ap-pf-card-v2 .ap-pf-stock-unknown { background: rgba(148,163,184,.14); border-color: rgba(148,163,184,.3); }
#page-analista_productos[data-ap-theme="dark"] .ap-pf-card-v2 .ap-pf-stock-ok  { color: #4ade80; }
#page-analista_productos[data-ap-theme="dark"] .ap-pf-card-v2 .ap-pf-stock-low { color: #fbbf24; }
#page-analista_productos[data-ap-theme="dark"] .ap-pf-card-v2 .ap-pf-stock-out { color: #f87171; }
#page-analista_productos[data-ap-theme="dark"] .ap-pf-card-v2 .ap-pf-v2-kpi-win .ap-pf-v2-kpi-lbl,
#page-analista_productos[data-ap-theme="dark"] .ap-pf-card-v2 .ap-pf-v2-gan,
#page-analista_productos[data-ap-theme="dark"] .ap-pf-card-v2 .ap-pf-v2-gan .ap-pf-ganancia-input,
#page-analista_productos[data-ap-theme="dark"] .ap-pf-card-v2 .ap-pf-v2-margin { color: #34d399; }
#page-analista_productos[data-ap-theme="dark"] .ap-pf-card-v2 .ap-pf-v2-chip.active { color: #a5b4fc; }

/* Sin borde negro de foco al hacer clic en el título de una sección;
   con teclado (focus-visible) se sigue viendo un anillo suave. */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sec-head:focus { outline: none; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-sec-head:focus-visible { outline: 2px solid rgba(99,102,241,.5); outline-offset: -2px; border-radius: 14px; }

/* ── Chips de cantidad: sin stock suficiente ── */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-chip.no-stock { opacity: .5; cursor: not-allowed; border-style: dashed; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-chip.no-stock small { color: #dc2626; font-weight: 700; }
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-chip.active.no-stock { opacity: .75; border-color: #dc2626; background: rgba(220,38,38,.08); color: #dc2626; }

/* ── Modal de detalle: botones Guardar (pedido 27/09/2026). El modal se
   monta en <body>, fuera del módulo — por eso sin prefijo de página. ── */
.cp-detail-save-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.cp-detail-save-status { margin-right: auto; font-size: 11.5px; color: #10b981; }
.cp-detail-save-status.dirty { color: #f59e0b; font-weight: 700; }
.cp-detail-save-btn { padding: 8px 14px; border-radius: 9px; font-size: 12px; font-weight: 700; cursor: pointer; }
.cp-detail-save-btn:disabled { opacity: .45; cursor: not-allowed; }

/* Vista previa del título por cantidad que ve el comprador en ML */
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-pack-preview {
  padding: 8px 10px; border-radius: 9px; background: rgba(255,230,0,.12); border: 1px solid rgba(234,179,8,.35); color: var(--ap-text2);
}
#page-analista_productos .ap-pf-card-v2 .ap-pf-v2-pack-preview strong { color: var(--ap-text); font-weight: 700; }
