/* Novedades en directo: avisos, números que cambian, «Novedades de hoy» y
   «Hay datos nuevos desde este análisis». Solo variables --sp-*. */

/* ── Avisos ─────────────────────────────────────────────────────────── */
.nv-avisos {
  position: fixed; right: 20px; top: 68px; z-index: 9990;
  display: flex; flex-direction: column; gap: 10px;
  width: min(360px, calc(100vw - 32px)); pointer-events: none;
}
@media (max-width: 640px) {
  .nv-avisos { left: 16px; right: 16px; width: auto; top: calc(12px + env(safe-area-inset-top, 0px)); }
}
.nv-aviso {
  pointer-events: auto; position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px 14px; border-radius: 14px;
  background: var(--sp-bg-card, #fff); color: var(--sp-text-primary, #111827);
  border: 1px solid var(--sp-border, #e5e7eb);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .06);
  transform: translateY(-12px) scale(.98); opacity: 0;
  transition: transform 380ms cubic-bezier(.2, .9, .3, 1.2), opacity 280ms ease;
}
.nv-aviso.nv-dentro { transform: none; opacity: 1; }
.nv-aviso.nv-fuera { transform: translateX(24px); opacity: 0; transition-duration: 240ms; }
.nv-icono {
  flex: 0 0 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--sp-accent-light, rgba(79, 70, 229, .1)); color: var(--sp-accent, #4F46E5);
}
.nv-icono svg { width: 18px; height: 18px; }
.nv-cuerpo { flex: 1; min-width: 0; }
.nv-titulo { margin: 0; font-size: 13.5px; font-weight: 650; line-height: 1.3; }
.nv-detalle { margin: 2px 0 0; font-size: 12.5px; line-height: 1.35; color: var(--sp-text-muted, #6b7280); }
.nv-cerrar {
  flex: 0 0 auto; border: 0; background: transparent; color: var(--sp-text-muted, #6b7280);
  width: 26px; height: 26px; border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1;
}
.nv-cerrar:hover { background: var(--sp-bg-hover, rgba(0, 0, 0, .05)); }
.nv-tiempo {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: var(--sp-accent, #4F46E5); opacity: .35; transform-origin: left;
  animation: nv-tiempo var(--nv-dura, 6s) linear forwards;
}
.nv-aviso:hover .nv-tiempo { animation-play-state: paused; }
@keyframes nv-tiempo { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ── Números que acaban de cambiar ──────────────────────────────────── */
.nv-cambio { border-radius: 6px; animation: nv-cambio 1800ms ease-out 1; }
@keyframes nv-cambio {
  0%   { background-color: rgba(79, 70, 229, 0); box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
  18%  { background-color: rgba(79, 70, 229, .14); box-shadow: 0 0 0 4px rgba(79, 70, 229, .10); }
  100% { background-color: rgba(79, 70, 229, 0); box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

/* ── Novedades de hoy (panel del gestor) ────────────────────────────── */
.nv-head { padding: 14px 20px 12px; border-bottom: 1px solid var(--sp-border); display: flex;
  align-items: center; justify-content: space-between; gap: 12px; }
.nv-h3 { font-size: 14px; font-weight: 700; color: var(--sp-text-primary); margin: 0;
  display: flex; align-items: center; gap: 8px; }
.nv-sub { font-size: 11px; color: var(--sp-text-muted); }
.nv-pulso { width: 8px; height: 8px; border-radius: 50%; background: var(--sp-success, #059669);
  box-shadow: 0 0 0 0 rgba(5, 150, 105, .45); animation: nv-pulso 2.4s ease-out infinite; }
@keyframes nv-pulso { 0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, .45); }
  70% { box-shadow: 0 0 0 8px rgba(5, 150, 105, 0); } 100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); } }
.nv-lista { list-style: none; margin: 0; padding: 4px 0; }
.nv-fila + .nv-fila { border-top: 1px solid var(--sp-border); }
.nv-enlace { display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: inherit;
  text-decoration: none; transition: background 120ms; }
.nv-enlace:hover { background: var(--sp-bg-hover, rgba(0, 0, 0, .03)); }
.nv-avatar { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--sp-accent-light); color: var(--sp-accent); font-size: 11px; font-weight: 700; }
.nv-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nv-empresa { font-size: 13px; font-weight: 600; color: var(--sp-text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-que { font-size: 12px; color: var(--sp-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-n { opacity: .8; }
.nv-chip { font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 999px; white-space: nowrap;
  background: rgba(5, 150, 105, .1); color: var(--sp-success); border: 1px solid rgba(5, 150, 105, .2); }
.nv-hora { font-size: 12px; color: var(--sp-text-muted); font-variant-numeric: tabular-nums; }
.nv-vacio { margin: 0; padding: 16px 20px; font-size: 13px; color: var(--sp-text-muted); line-height: 1.5; }
.nv-fila.nv-nueva { animation: nv-entra 700ms cubic-bezier(.2, .9, .3, 1) 1; }
@keyframes nv-entra { from { opacity: 0; transform: translateY(-6px); background: rgba(79, 70, 229, .08); }
  to { opacity: 1; transform: none; background: transparent; } }

/* ── Hay datos nuevos desde este análisis ───────────────────────────── */
.nv-analisis {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 9980;
  width: min(720px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px;
  border-radius: 14px; background: var(--sp-bg-card, #fff); color: var(--sp-text-primary, #111827);
  border: 1px solid var(--sp-border, #e5e7eb);
  box-shadow: 0 14px 36px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .06);
  transform: translate(-50%, 16px); opacity: 0;
  transition: transform 380ms cubic-bezier(.2, .9, .3, 1.2), opacity 260ms;
}
@media (max-width: 640px) { .nv-analisis { flex-wrap: wrap; } }
.nv-analisis.nv-dentro { transform: translate(-50%, 0); opacity: 1; }
.nv-analisis p { margin: 0; flex: 1; min-width: 200px; font-size: 13px; line-height: 1.4; }
.nv-analisis p span { color: var(--sp-text-muted); }
.nv-boton { border: 0; border-radius: 10px; padding: 8px 12px; font-size: 12.5px; font-weight: 650; cursor: pointer;
  background: var(--sp-accent); color: #fff; text-decoration: none; white-space: nowrap; }
.nv-boton:hover { filter: brightness(1.08); }

@media (prefers-reduced-motion: reduce) {
  .nv-aviso { transition: opacity 120ms; transform: none; }
  .nv-analisis { transition: opacity 120ms; }
  .nv-cambio, .nv-fila.nv-nueva, .nv-pulso { animation: none; }
  .nv-tiempo { animation-duration: var(--nv-dura, 6s); }
}
