/* ===================== Tarjetas «premium» de Análisis de Ventas (12-oct-2026) =====================
   Pedido de Jose: «puede mejorar los cards hacerlos más premium en análisis de ventas».
   Solo afecta a .ventas-wrap. Rasgos: fondo con un brillo suave arriba, borde fino, sombra en
   capas con un filo de luz interior y una marca de acento junto al título de cada tarjeta.
   Los indicadores (kpi-tile) siguen el estilo de HFC desde la ronda 3 (ver su sección).
   El tema iOS conserva su estilo propio (tarjetas blancas planas, ver tema-ios.css): las reglas
   decorativas van con body:not(.ios). Con «reducir movimiento» no hay elevación.
   Al compartir como imagen, 19-compartir.js quita las sombras/fondos con colores que html2canvas
   no entiende, así que la captura sale limpia. */

/* --- base: fondo, borde y sombra en capas --- */
body:not(.ios) .ventas-wrap :is(.card:not(.kpi-tile),.chart-mini){
  position:relative;
  background:linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,0) 46%), var(--surface);
  border:1px solid color-mix(in srgb, var(--border2) 65%, transparent);
  border-radius:16px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.06), 0 1px 2px rgba(0,0,0,.22), 0 16px 36px -20px rgba(0,0,0,.65);
  transition:transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s ease, border-color .22s ease;
}
body:not(.ios) .ventas-wrap :is(.card:not(.kpi-tile),.chart-mini):hover{
  border-color:color-mix(in srgb, var(--accent) 40%, var(--border2));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08), 0 2px 4px rgba(0,0,0,.22),
    0 24px 46px -22px color-mix(in srgb, var(--accent) 38%, rgba(0,0,0,.75));
}
/* tema Día: papel cálido y sombra suave, sin el filo de luz (no se ve sobre blanco) */
body.light:not(.ios) .ventas-wrap :is(.card:not(.kpi-tile),.chart-mini){
  background:linear-gradient(180deg, #ffffff, #fbf9f4);
  border-color:color-mix(in srgb, var(--border2) 55%, transparent);
  box-shadow:0 1px 2px rgba(30,20,0,.06), 0 14px 30px -18px rgba(30,20,0,.25);
}
body.light:not(.ios) .ventas-wrap :is(.card:not(.kpi-tile),.chart-mini):hover{
  border-color:color-mix(in srgb, var(--accent) 45%, var(--border2));
  box-shadow:0 2px 4px rgba(30,20,0,.07), 0 22px 40px -20px color-mix(in srgb, var(--accent) 30%, rgba(30,20,0,.35));
}

/* --- indicadores (kpi-tile) al estilo HFC (pedido de Jose 2026-10-12: «estaban muy anchas las cards,
   quizá un estilo más parecido al HFC y un poco menos ancho»). Copia adaptada de /opt/hfc/css/kpi-v2.css:
   tarjetas sueltas (ver la grilla: desde la ronda 4 ocupan todo el ancho), franja de color a la izquierda
   según el estado de la cifra (verde/amarillo/rojo, si no el acento), ícono en recuadro junto al rótulo
   (lo pone _iconosKpiVentas en 10-ventas.js), rótulo en letra normal, cifra tabular. Al pasar el mouse
   sube, el borde toma su color, la cifra crece un poco y las demás se atenúan. --- */
.ventas-wrap .kpi-tiles,
.ventas-wrap .kpi-tiles.kpi-tiles-6{grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}
/* auto-fit (no auto-fill): las tarjetas se reparten todo el ancho del apartado y sus bordes calzan
   con los de los demás contenedores (pedido de Jose 2026-10-12: «centra las tarjetas de acuerdo al
   ancho del margen para que calce dentro de los demás contenedores»). */
.ventas-wrap .kpi-tile{
  --kc:var(--accent);
  position:relative;overflow:hidden;min-width:0;display:flex;flex-direction:column;
  padding:12px 14px 11px 17px;
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease, opacity .18s ease;
}
.ventas-wrap .kpi-tile:has(.kt-val.verde){--kc:var(--verde-t)}
.ventas-wrap .kpi-tile:has(.kt-val.amarillo){--kc:var(--gold)}
.ventas-wrap .kpi-tile:has(.kt-val.rojo){--kc:var(--rojo-t)}
body:not(.ios) .ventas-wrap .kpi-tile{
  background:var(--surface);border:1px solid var(--border);border-radius:14px;box-shadow:0 1px 2px rgba(0,0,0,.18);
}
.ventas-wrap .kpi-tile::before{
  content:'';position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--kc);transition:width .18s ease;
}
.ventas-wrap .kpi-tile:hover{
  transform:translateY(-4px);z-index:2;
  border-color:color-mix(in srgb, var(--kc) 60%, transparent);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--kc) 16%, transparent), 0 14px 30px rgba(0,0,0,.28);
}
body.light .ventas-wrap .kpi-tile:hover{box-shadow:0 0 0 3px color-mix(in srgb, var(--kc) 16%, transparent), 0 14px 28px rgba(30,20,0,.14)}
.ventas-wrap .kpi-tile:hover::before{width:5px}
.ventas-wrap .kpi-tiles:hover .kpi-tile:not(:hover){opacity:.6}
/* rótulo: ícono en recuadro + texto normal (no mono ni mayúsculas) */
.ventas-wrap .kpi-tile .kt-lbl{
  display:flex;align-items:center;gap:8px;margin-bottom:6px;
  font-family:var(--sans);font-size:12.5px;font-weight:650;letter-spacing:.005em;text-transform:none;color:var(--text);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.ventas-wrap .kpi-tile .kt-ico{
  width:26px;height:26px;border-radius:8px;flex:0 0 26px;display:grid;place-items:center;font-size:14px;
  background:color-mix(in srgb, var(--kc) 16%, transparent);color:var(--kc);
}
/* cifra: sans tabular; crece un poco al pasar el mouse */
.ventas-wrap .kpi-tile .kt-val{
  font-family:var(--sans);font-size:26px;font-weight:700;letter-spacing:-.5px;line-height:1.1;margin:2px 0 4px;
  font-variant-numeric:tabular-nums;transition:font-size .18s ease, text-shadow .18s ease;
}
.ventas-wrap .kpi-tile:hover .kt-val{font-size:28.5px;text-shadow:0 0 18px color-mix(in srgb, var(--kc) 35%, transparent)}
.ventas-wrap .kpi-tile .kt-sub{font-size:11.5px;line-height:1.4}
.ventas-wrap .kpi-tile .kt-sub-lg{font-size:12px;line-height:1.5}
.ventas-wrap .kpi-tile .kt-track{height:5px}
.ventas-wrap .kpi-tile .kt-fill{background:var(--kc)}

/* --- títulos de tarjeta: marca de acento a la izquierda --- */
body:not(.ios) .ventas-wrap :is(.cardhead h3,.cmi-head){letter-spacing:-.01em}
body:not(.ios) .ventas-wrap .cardhead h3::before,
body:not(.ios) .ventas-wrap .cmi-head::before{
  content:'';display:inline-block;width:3px;height:12px;margin-right:8px;border-radius:2px;vertical-align:-1px;
  background:linear-gradient(180deg, var(--accent), var(--violet));
}

@media (prefers-reduced-motion:reduce){
  .ventas-wrap :is(.card,.chart-mini){transition:none}
  .ventas-wrap .kpi-tile,.ventas-wrap .kpi-tile:hover{transform:none}
}
@media (max-width:640px){
  .ventas-wrap .kpi-tiles,.ventas-wrap .kpi-tiles.kpi-tiles-6{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .ventas-wrap .kpi-tile .kt-val,.ventas-wrap .kpi-tile:hover .kt-val{font-size:22px}
  .ventas-wrap .kpi-tile{padding:10px 10px 9px 13px}
  .ventas-wrap .kpi-tile .kt-lbl{white-space:normal;align-items:flex-start;font-size:12px;line-height:1.25;gap:6px}
  .ventas-wrap .kpi-tile .kt-ico{width:22px;height:22px;flex-basis:22px;font-size:12px;border-radius:7px}
}

/* ===================== Ronda 2 (12-oct-2026): comparativo vs. mes anterior y más acabado =====================
   Pedido de Jose: «en las etiquetas se puede agregar un comparativo y variación vs el mes anterior y sigue
   mejorando el diseño, más premium». */

/* --- comparativo vs. mes anterior: al pie de la tarjeta, compacto --- */
.ventas-wrap .kpi-tile .kt-cmp{
  margin-top:auto;padding-top:7px;display:flex;align-items:center;gap:4px 6px;flex-wrap:wrap;
  font-size:10.5px;color:var(--dim);line-height:1.3;min-width:0;
}
.ventas-wrap .kpi-tile .kt-cmp .kt-cmp-txt{white-space:normal}
.kt-chip{
  display:inline-flex;align-items:center;gap:3px;padding:2px 8px;border-radius:999px;
  font-family:var(--mono);font-size:10.5px;font-weight:800;white-space:nowrap;font-variant-numeric:tabular-nums;
}
.kt-chip.pos{background:var(--verde-bg);color:var(--verde-t);box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--verde-t) 28%, transparent)}
.kt-chip.neg{background:var(--rojo-bg);color:var(--rojo-t);box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--rojo-t) 28%, transparent)}
.kt-chip.neutro{background:var(--surface3);color:var(--dim)}
.kt-cmp-txt{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
body.ios .kt-chip{font-family:var(--sans);font-weight:700}

/* --- cintas de cada apartado: píldora con borde degradado y punto con halo --- */
body:not(.ios) .ventas-wrap .ribbon{
  border:1px solid transparent;
  background:linear-gradient(var(--surface2), var(--surface2)) padding-box,
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), color-mix(in srgb, var(--violet) 45%, transparent)) border-box;
  box-shadow:0 6px 18px -12px color-mix(in srgb, var(--accent) 60%, transparent);
}
body:not(.ios) .ventas-wrap .ribbon-txt{color:var(--bright);letter-spacing:.9px}

/* --- barras de filtros: misma superficie que las tarjetas --- */
body:not(.ios) .ventas-wrap .filtros{
  background:linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,0) 60%), var(--surface);
  border:1px solid color-mix(in srgb, var(--border2) 65%, transparent);
  border-radius:16px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05), 0 10px 26px -20px rgba(0,0,0,.6);
}
body.light:not(.ios) .ventas-wrap .filtros{
  background:linear-gradient(180deg, #ffffff, #fbf9f4);
  box-shadow:0 1px 2px rgba(30,20,0,.05), 0 10px 22px -18px rgba(30,20,0,.22);
}

/* --- tabla de campañas: encabezado con degradado, filas con realce al pasar el mouse --- */
body:not(.ios) .ventas-wrap .vta-camp-table thead th{
  background:linear-gradient(180deg, var(--surface3), var(--surface2));
  letter-spacing:.7px;
}
body:not(.ios) .ventas-wrap .vta-camp-table tbody tr.vt-sub:hover td{background:color-mix(in srgb, var(--accent) 7%, transparent)}
body:not(.ios) .ventas-wrap .vta-camp-table tfoot td{
  background:linear-gradient(180deg, var(--surface2), var(--surface3));
  border-top:1px solid color-mix(in srgb, var(--accent) 35%, var(--border2));
}
.ventas-wrap .vt-badge{padding:3px 8px;border-radius:999px;letter-spacing:.3px}

/* --- barras de avance (vista rápida, participación, geografía): pista más fina y relleno con brillo --- */
body:not(.ios) .ventas-wrap .camp-track{background:color-mix(in srgb, var(--surface3) 80%, transparent);box-shadow:inset 0 1px 2px rgba(0,0,0,.18)}
body:not(.ios) .ventas-wrap .camp-fill{background-image:linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,0) 60%)}
body:not(.light) .ventas-wrap .camp-fill{box-shadow:0 0 8px -1px currentColor}

/* --- botones segmentados dentro de las tarjetas: opción activa con degradado --- */
body:not(.ios) .ventas-wrap .seg button.active{
  background:linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--violet)));
  box-shadow:0 4px 12px -6px color-mix(in srgb, var(--accent) 80%, transparent);
}
