/* ═══════════════════════════════════════════════════════════════
   RENEWAL RESCUE — Proactive outreach & churn prevention
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════ HEADER ═══════════════ */
.rr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.rr-header-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.rr-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin: 0;
}

.rr-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.rr-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.rr-timestamp {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ═══════════════ ALERT BANNER ═══════════════ */
.rr-alert-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, var(--error-muted) 0%, var(--orange-muted) 100%);
  border: 1px solid var(--error);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}

.rr-alert-icon {
  font-size: 1.5rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

.rr-alert-text {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.btn-accent {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

.btn-accent:hover {
  background: var(--error);
  opacity: 0.9;
}

/* ═══════════════ SUMMARY GRID ═══════════════ */
.rr-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.rr-summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal);
  border-left: 4px solid var(--card-color, var(--border-subtle));
}

.rr-summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--card-color, var(--border-default));
}

.rr-summary-card.active {
  background: var(--card-bg, var(--bg-hover));
  border-color: var(--card-color, var(--accent));
  box-shadow: var(--shadow-lg);
}

.rr-summary-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-2);
}

.rr-summary-count {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--card-color, var(--text-primary));
}

.rr-summary-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-1);
}

.rr-summary-premium {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-2);
}

.rr-summary-total {
  background: var(--bg-elevated);
  border-left-color: var(--accent);
}

.rr-summary-total .rr-summary-count {
  color: var(--accent);
}

/* ═══════════════ STATUS BAR ═══════════════ */
.rr-status-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}

.rr-status-header {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.rr-status-bar {
  display: flex;
  height: 40px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
  gap: 2px;
}

.rr-status-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--seg-color);
  opacity: 0.3;
  cursor: pointer;
  transition: all var(--duration-fast);
  min-width: 50px;
}

.rr-status-segment:hover {
  opacity: 0.5;
}

.rr-status-segment.active {
  opacity: 1;
}

.rr-status-icon {
  font-size: 0.9rem;
}

.rr-status-count {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: #fff;
}

.rr-status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.rr-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast);
}

.rr-legend-item:hover {
  background: var(--bg-hover);
}

.rr-legend-item.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.rr-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ═══════════════ TOOLBAR ═══════════════ */
.rr-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.rr-search {
  flex: 1;
  min-width: 200px;
  max-width: 300px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

.rr-search:focus {
  border-color: var(--accent);
  outline: none;
}

.rr-sort-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.rr-sort-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.rr-clear-btn {
  color: var(--error) !important;
}

/* ═══════════════ PIPELINE LIST ═══════════════ */
.rr-pipeline {
  min-height: 200px;
}

.rr-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.rr-card {
  display: flex;
  align-items: stretch;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.rr-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}

.rr-card-urgency {
  width: 4px;
  flex-shrink: 0;
}

.rr-card-main {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  min-width: 0;
}

.rr-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.rr-card-customer {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.rr-card-days {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
}

.rr-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.rr-card-premium {
  font-weight: var(--weight-semibold);
  color: var(--success);
}

.rr-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.rr-card-status {
  font-weight: var(--weight-semibold);
}

.rr-card-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* ═══════════════ EMPTY STATE ═══════════════ */
.rr-empty {
  padding: var(--space-10);
  text-align: center;
  color: var(--text-muted);
}

.rr-empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-3);
  opacity: 0.5;
}

.rr-empty-text {
  font-size: var(--text-sm);
}

/* ═══════════════ MODAL ═══════════════ */
.rr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal);
}

.rr-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.rr-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal);
  display: flex;
  flex-direction: column;
}

.rr-modal.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.rr-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.rr-modal-header h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

.rr-modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
}

.rr-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.rr-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.rr-detail-section {
  margin-bottom: var(--space-5);
}

.rr-detail-section h4 {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin: 0 0 var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rr-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.rr-detail-row:last-child {
  border-bottom: none;
}

.rr-detail-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.rr-detail-value {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

.rr-detail-customer {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
}

.rr-detail-premium {
  color: var(--success);
  font-size: var(--text-base);
}

.rr-detail-badge {
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.rr-outreach-empty {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-style: italic;
}

.rr-outreach-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
}

.rr-outreach-channel {
  font-weight: var(--weight-semibold);
}

.rr-outreach-date {
  color: var(--text-muted);
}

.rr-outreach-template {
  flex: 1;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rr-notes-input {
  width: 100%;
  min-height: 80px;
  padding: var(--space-3);
  font-size: var(--text-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  resize: vertical;
}

.rr-notes-input:focus {
  border-color: var(--accent);
  outline: none;
}

.rr-modal-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.rr-status-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.rr-status-btn {
  flex: 1;
  min-width: 80px;
}

.rr-status-btn.active {
  background: var(--btn-color);
  color: #fff;
  border-color: var(--btn-color);
}

.rr-action-buttons {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

/* ═══════════════ RESPONSIVE ═══════════════ */
@media (max-width: 768px) {
  .rr-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .rr-card {
    flex-direction: column;
  }

  .rr-card-urgency {
    width: 100%;
    height: 4px;
  }

  .rr-card-actions {
    flex-direction: row;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }

  .rr-modal {
    width: 95%;
    max-height: 95vh;
  }

  .rr-status-buttons {
    justify-content: center;
  }

  .rr-action-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .rr-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .rr-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .rr-search {
    max-width: none;
  }

  .rr-sort-group {
    justify-content: center;
  }
}
