/* ============================================
   Recientes V2 — Modern Analysis History
   Scoped under body.ui-shell so it is inert
   when the feature flag is off.
   ============================================ */

/* ---------- Command Bar ---------- */
body.ui-shell .rv2-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ui-s-4);
  margin-bottom: var(--ui-s-5);
  flex-wrap: wrap;
}

body.ui-shell .rv2-header__left {
  display: flex;
  flex-direction: column;
  gap: var(--ui-s-1);
}

body.ui-shell .rv2-header__title {
  font-size: var(--ui-text-2xl);
  font-weight: 700;
  color: var(--ui-text);
  margin: 0;
  letter-spacing: -0.02em;
}

body.ui-shell .rv2-header__sub {
  font-size: var(--ui-text-md);
  color: var(--ui-muted);
  margin: 0;
}

body.ui-shell .rv2-stats {
  display: flex;
  gap: var(--ui-s-3);
  flex-wrap: wrap;
}

body.ui-shell .rv2-stat {
  display: flex;
  align-items: center;
  gap: var(--ui-s-2);
  padding: var(--ui-s-2) var(--ui-s-3);
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-r-sm);
  font-size: var(--ui-text-sm);
  color: var(--ui-muted);
}

body.ui-shell .rv2-stat__value {
  font-weight: 700;
  color: var(--ui-text);
}

/* ---------- Command Bar Row ---------- */
body.ui-shell .rv2-command {
  display: flex;
  align-items: center;
  gap: var(--ui-s-3);
  margin-bottom: var(--ui-s-5);
  flex-wrap: wrap;
}

body.ui-shell .rv2-search {
  flex: 1;
  min-width: 220px;
  position: relative;
}

body.ui-shell .rv2-search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ui-muted-2);
  pointer-events: none;
}

body.ui-shell .rv2-search__input {
  width: 100%;
  height: 42px;
  border-radius: var(--ui-r-sm);
  border: 1px solid var(--ui-border);
  background: var(--ui-surface);
  padding: 0 12px 0 38px;
  font-size: var(--ui-text-md);
  font-family: var(--ui-font-sans);
  color: var(--ui-text);
  transition: box-shadow 120ms ease, border-color 120ms ease;
}

body.ui-shell .rv2-search__input::placeholder {
  color: var(--ui-muted-2);
}

body.ui-shell .rv2-search__input:focus {
  outline: none;
  border-color: rgba(91, 92, 255, 0.55);
  box-shadow: 0 0 0 4px var(--ui-focus);
}

body.ui-shell .rv2-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface);
  font-size: var(--ui-text-sm);
  font-weight: 500;
  color: var(--ui-muted);
  cursor: pointer;
  transition: all 120ms ease;
  font-family: var(--ui-font-sans);
}

body.ui-shell .rv2-filter-chip:hover {
  border-color: var(--ui-accent);
  color: var(--ui-accent);
  background: rgba(91, 92, 255, 0.04);
}

body.ui-shell .rv2-filter-chip svg {
  width: 14px;
  height: 14px;
}

/* ---------- Bulk actions bar ---------- */
body.ui-shell .rv2-bulk {
  display: flex;
  align-items: center;
  gap: var(--ui-s-3);
  margin-bottom: var(--ui-s-4);
  flex-wrap: wrap;
}

/* ---------- Card V2 ---------- */
body.ui-shell .rv2-card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-r-lg);
  box-shadow: var(--ui-sh-sm);
  margin-bottom: var(--ui-s-4);
  transition: box-shadow 150ms ease, border-color 150ms ease;
  overflow: visible;
  position: relative;
}

body.ui-shell .rv2-card:hover {
  box-shadow: var(--ui-sh-md);
  border-color: rgba(91, 92, 255, 0.25);
}

body.ui-shell .rv2-card__checkbox {
  position: absolute;
  top: var(--ui-s-4);
  right: var(--ui-s-4);
  width: 18px;
  height: 18px;
  cursor: pointer;
  z-index: 10;
  accent-color: var(--ui-accent);
}

body.ui-shell .rv2-card__body {
  padding: var(--ui-s-5);
  cursor: pointer;
}

body.ui-shell .rv2-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ui-s-4);
  margin-bottom: var(--ui-s-4);
}

body.ui-shell .rv2-card__info {
  flex: 1;
  min-width: 0;
}

body.ui-shell .rv2-card__title-row {
  display: flex;
  align-items: center;
  gap: var(--ui-s-2);
  margin-bottom: 6px;
  flex-wrap: wrap;
}

body.ui-shell .rv2-card__title {
  font-size: var(--ui-text-lg);
  font-weight: 700;
  color: var(--ui-text);
  margin: 0;
  letter-spacing: -0.01em;
}

body.ui-shell .rv2-card__edit-btn {
  background: none;
  border: none;
  color: var(--ui-muted-2);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 100ms ease;
  display: inline-flex;
  align-items: center;
}

body.ui-shell .rv2-card__edit-btn:hover {
  color: var(--ui-accent);
  background: rgba(91, 92, 255, 0.06);
}

body.ui-shell .rv2-card__objective {
  font-size: var(--ui-text-sm);
  color: var(--ui-muted);
  margin: 0;
  line-height: var(--ui-lh-relaxed);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Status chip ---------- */
body.ui-shell .rv2-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

body.ui-shell .rv2-status--listo {
  background: rgba(34, 197, 94, 0.10);
  color: #0f5132;
}

body.ui-shell .rv2-status--procesando {
  background: rgba(245, 158, 11, 0.12);
  color: #7a4b00;
}

body.ui-shell .rv2-status--error {
  background: rgba(239, 68, 68, 0.10);
  color: #7f1d1d;
}

/* ---------- Stacked sentiment bar ---------- */
body.ui-shell .rv2-bar-container {
  margin-bottom: var(--ui-s-3);
}

body.ui-shell .rv2-bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

body.ui-shell .rv2-bar-label__text {
  font-size: 11px;
  font-weight: 600;
  color: var(--ui-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.ui-shell .rv2-bar-label__total {
  font-size: var(--ui-text-sm);
  font-weight: 700;
  color: var(--ui-text);
}

body.ui-shell .rv2-bar {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.05);
}

body.ui-shell .rv2-bar__seg {
  height: 100%;
  transition: width 300ms ease;
  min-width: 0;
}

body.ui-shell .rv2-bar__seg--pos { background: #34D399; }
body.ui-shell .rv2-bar__seg--neu { background: #8B93A7; }
body.ui-shell .rv2-bar__seg--neg { background: #F8716A; }
body.ui-shell .rv2-bar__seg--mix { background: #F2B65A; }

body.ui-shell .rv2-bar-legend {
  display: flex;
  gap: var(--ui-s-4);
  margin-top: 8px;
  flex-wrap: wrap;
}

body.ui-shell .rv2-bar-legend__item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ui-muted);
}

body.ui-shell .rv2-bar-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

body.ui-shell .rv2-bar-legend__num {
  font-weight: 700;
  color: var(--ui-text);
}

/* ---------- Card footer ---------- */
body.ui-shell .rv2-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ui-s-3) var(--ui-s-5);
  border-top: 1px solid var(--ui-border);
  gap: var(--ui-s-3);
}

body.ui-shell .rv2-card__meta {
  display: flex;
  gap: var(--ui-s-4);
  flex-wrap: wrap;
  align-items: center;
}

body.ui-shell .rv2-card__meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ui-muted);
}

body.ui-shell .rv2-card__meta-item svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

body.ui-shell .rv2-card__actions {
  display: flex;
  align-items: center;
  gap: var(--ui-s-2);
  flex-shrink: 0;
}

body.ui-shell .rv2-card__open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--ui-r-sm);
  border: none;
  background: var(--ui-accent);
  color: #fff;
  font-size: var(--ui-text-sm);
  font-weight: 600;
  font-family: var(--ui-font-sans);
  cursor: pointer;
  transition: all 120ms ease;
}

body.ui-shell .rv2-card__open-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91, 92, 255, 0.25);
}

/* ---------- Kebab menu ---------- */
body.ui-shell .rv2-kebab {
  position: relative;
}

body.ui-shell .rv2-kebab__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface);
  cursor: pointer;
  color: var(--ui-muted);
  transition: all 100ms ease;
  padding: 0;
}

body.ui-shell .rv2-kebab__btn:hover {
  background: rgba(15, 23, 42, 0.04);
  color: var(--ui-text);
}

body.ui-shell .rv2-kebab__menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-r-sm);
  box-shadow: var(--ui-sh-md);
  min-width: 160px;
  z-index: 50;
  padding: 4px 0;
  display: none;
}

body.ui-shell .rv2-kebab__menu.is-open {
  display: block;
}

body.ui-shell .rv2-kebab__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  font-size: var(--ui-text-sm);
  color: var(--ui-text);
  cursor: pointer;
  font-family: var(--ui-font-sans);
  transition: background 80ms ease;
  text-align: left;
}

body.ui-shell .rv2-kebab__item:hover {
  background: rgba(15, 23, 42, 0.04);
}

body.ui-shell .rv2-kebab__item--danger {
  color: var(--ui-danger);
}

body.ui-shell .rv2-kebab__item--danger:hover {
  background: rgba(239, 68, 68, 0.06);
}

body.ui-shell .rv2-kebab__item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ---------- AI Highlights ---------- */
body.ui-shell .rv2-highlights {
  background: rgba(91, 92, 255, 0.03);
  border: 1px solid rgba(91, 92, 255, 0.10);
  border-radius: var(--ui-r-sm);
  padding: var(--ui-s-3) var(--ui-s-4);
  margin-bottom: var(--ui-s-3);
}

body.ui-shell .rv2-highlights__label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ui-accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

body.ui-shell .rv2-highlights__text {
  font-size: var(--ui-text-sm);
  color: var(--ui-muted);
  line-height: var(--ui-lh-relaxed);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Active Jobs (V2 override) ---------- */
body.ui-shell .rv2-jobs {
  background: var(--ui-surface);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--ui-r-lg);
  padding: var(--ui-s-4);
  margin-bottom: var(--ui-s-5);
}

/* ---------- Empty state V2 ---------- */
body.ui-shell .rv2-empty {
  text-align: center;
  padding: 64px 32px;
  background: var(--ui-surface-2);
  border: 1px dashed var(--ui-border);
  border-radius: var(--ui-r-lg);
}

body.ui-shell .rv2-empty__icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--ui-s-5);
  background: rgba(91, 92, 255, 0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.ui-shell .rv2-empty__title {
  font-size: var(--ui-text-xl);
  font-weight: 700;
  color: var(--ui-text);
  margin: 0 0 var(--ui-s-2) 0;
}

body.ui-shell .rv2-empty__desc {
  font-size: var(--ui-text-md);
  color: var(--ui-muted);
  margin: 0 auto var(--ui-s-5);
  max-width: 380px;
  line-height: var(--ui-lh-relaxed);
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  body.ui-shell .rv2-header {
    flex-direction: column;
    align-items: flex-start;
  }
  body.ui-shell .rv2-stats {
    width: 100%;
  }
  body.ui-shell .rv2-card__footer {
    flex-direction: column;
    align-items: flex-start;
  }
  body.ui-shell .rv2-card__actions {
    width: 100%;
    justify-content: flex-end;
  }
}
