/**
 * RCA Accelerator - AI-Powered Root Cause Analysis Tool
 * Following CMPC 8-step RCA Methodology
 * 
 * Color Palette:
 * - Primary: #10b981 (teal/emerald)
 * - Secondary: #3b82f6 (blue)
 * - Accent: #f59e0b (amber)
 * - Success: #22c55e (green)
 * - Warning: #eab308 (yellow)
 * - Error: #ef4444 (red)
 */

/* =====================================================
   MAIN CONTAINER & HEADER
   ===================================================== */

.rca-accelerator {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

.rca-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.rca-title-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.rca-main-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

.rca-icon {
  font-size: 2rem;
}

.rca-subtitle {
  color: #9ca3af;
  font-size: 0.875rem;
  margin: 0;
}

.rca-header-actions {
  display: flex;
  gap: 0.75rem;
}

/* =====================================================
   STATS GRID
   ===================================================== */

.rca-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .rca-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.rca-stat-card {
  background: rgba(31, 41, 55, 0.8);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid rgba(75, 85, 99, 0.4);
  transition: all 0.2s ease;
}

.rca-stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.4);
}

.rca-stat-icon {
  font-size: 2rem;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 10px;
}

.rca-stat-card.rca-stat-active .rca-stat-icon {
  background: rgba(59, 130, 246, 0.1);
}

.rca-stat-card.rca-stat-completed .rca-stat-icon {
  background: rgba(34, 197, 94, 0.1);
}

.rca-stat-card.rca-stat-actions .rca-stat-icon {
  background: rgba(245, 158, 11, 0.1);
}

.rca-stat-content {
  flex: 1;
}

.rca-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
  line-height: 1.2;
}

.rca-stat-label {
  color: #9ca3af;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =====================================================
   TAB NAVIGATION
   ===================================================== */

.rca-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid rgba(75, 85, 99, 0.3);
  padding-bottom: 0.5rem;
}

.rca-tab {
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rca-tab:hover {
  background: rgba(75, 85, 99, 0.3);
  color: white;
}

.rca-tab.active {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border-bottom: 2px solid #10b981;
  margin-bottom: -2px;
}

/* =====================================================
   CONTENT AREA
   ===================================================== */

.rca-content {
  min-height: 400px;
}

.rca-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  background: rgba(31, 41, 55, 0.5);
  border-radius: 12px;
  border: 2px dashed rgba(75, 85, 99, 0.4);
}

.rca-empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.rca-empty-state h3 {
  color: white;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.rca-empty-state p {
  color: #9ca3af;
  margin-bottom: 1.5rem;
}

/* =====================================================
   CASES LIST
   ===================================================== */

.rca-cases-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1rem;
}

.rca-case-card {
  background: rgba(31, 41, 55, 0.8);
  border-radius: 12px;
  padding: 1.25rem;
  border: 1px solid rgba(75, 85, 99, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
}

.rca-case-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.1);
}

.rca-case-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.rca-case-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.rca-case-status {
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  text-transform: uppercase;
}

.rca-case-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  margin: 0 0 0.75rem 0;
  line-height: 1.3;
}

.rca-case-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: #9ca3af;
  margin-bottom: 0.75rem;
}

.rca-case-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.rca-case-progress {
  margin-bottom: 0.75rem;
}

.rca-progress-bar {
  height: 6px;
  background: rgba(75, 85, 99, 0.5);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.rca-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #3b82f6);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.rca-progress-text {
  font-size: 0.7rem;
  color: #9ca3af;
}

.rca-case-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #6b7280;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(75, 85, 99, 0.3);
}

.rca-case-loss {
  color: #ef4444;
  font-weight: 600;
}

/* =====================================================
   BUTTONS
   ===================================================== */

.rca-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
}

.rca-btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.rca-btn-primary:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
}

.rca-btn-secondary {
  background: rgba(75, 85, 99, 0.5);
  color: #e5e7eb;
  border: 1px solid rgba(75, 85, 99, 0.6);
}

.rca-btn-secondary:hover {
  background: rgba(75, 85, 99, 0.7);
}

.rca-btn-outline {
  background: transparent;
  color: #9ca3af;
  border: 1px solid rgba(75, 85, 99, 0.6);
}

.rca-btn-outline:hover {
  background: rgba(75, 85, 99, 0.3);
  color: white;
}

.rca-btn-ai {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
}

.rca-btn-ai:hover {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
}

.rca-btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
}

.rca-btn-success:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.rca-btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

/* =====================================================
   MODAL
   ===================================================== */

.rca-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.rca-modal {
  background: rgb(31, 41, 55);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(75, 85, 99, 0.4);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.rca-modal-lg {
  max-width: 700px;
}

.rca-modal-ai {
  max-width: 600px;
  height: 70vh;
}

.rca-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(75, 85, 99, 0.4);
}

.rca-modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  margin: 0;
}

.rca-modal-close {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s ease;
}

.rca-modal-close:hover {
  color: white;
}

.rca-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.rca-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(75, 85, 99, 0.4);
  background: rgba(17, 24, 39, 0.5);
}

/* =====================================================
   WIZARD STEPS
   ===================================================== */

.rca-wizard-steps {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.rca-wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.rca-wizard-step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(75, 85, 99, 0.5);
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  transition: all 0.2s ease;
}

.rca-wizard-step.active .rca-wizard-step-number {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.rca-wizard-step.completed .rca-wizard-step-number {
  background: #22c55e;
  color: white;
}

.rca-wizard-step-label {
  font-size: 0.75rem;
  color: #9ca3af;
}

.rca-wizard-step.active .rca-wizard-step-label {
  color: #10b981;
  font-weight: 600;
}

.rca-wizard-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  margin-bottom: 0.5rem;
}

.rca-wizard-description {
  color: #9ca3af;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* =====================================================
   ELIGIBILITY QUESTIONS
   ===================================================== */

.rca-eligibility-questions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rca-question-card {
  background: rgba(17, 24, 39, 0.5);
  border-radius: 10px;
  padding: 1rem;
  border: 1px solid rgba(75, 85, 99, 0.3);
}

.rca-question-card.rca-question-highlight {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.05);
}

.rca-question-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.rca-question-number {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.rca-radio-group {
  display: flex;
  gap: 1.5rem;
  padding-left: 2.25rem;
}

.rca-radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #d1d5db;
  font-size: 0.875rem;
  cursor: pointer;
}

.rca-radio input[type="radio"] {
  accent-color: #10b981;
  width: 16px;
  height: 16px;
}

.rca-eligibility-result {
  margin-top: 1rem;
}

.rca-eligibility-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border-radius: 10px;
  border-width: 2px;
  border-style: solid;
}

.rca-eligibility-icon {
  font-size: 1.5rem;
}

.rca-eligibility-card strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #111827;
}

.rca-eligibility-card p {
  font-size: 0.875rem;
  color: #4b5563;
  margin: 0;
}

/* =====================================================
   FORM ELEMENTS
   ===================================================== */

.rca-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .rca-form-grid {
    grid-template-columns: 1fr;
  }
}

.rca-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.rca-form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #d1d5db;
}

.rca-form-full {
  grid-column: 1 / -1;
}

.rca-input,
.rca-select,
.rca-textarea {
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid rgba(75, 85, 99, 0.5);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  color: white;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.rca-input:focus,
.rca-select:focus,
.rca-textarea:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.rca-input::placeholder,
.rca-textarea::placeholder {
  color: #6b7280;
}

.rca-input-group {
  display: flex;
  align-items: center;
}

.rca-input-prefix {
  background: rgba(75, 85, 99, 0.5);
  padding: 0.625rem 0.75rem;
  border: 1px solid rgba(75, 85, 99, 0.5);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: #9ca3af;
  font-size: 0.875rem;
}

.rca-input-group .rca-input {
  border-radius: 0 8px 8px 0;
}

.rca-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(75, 85, 99, 0.3);
}

/* =====================================================
   CASE DETAIL VIEW
   ===================================================== */

.rca-case-detail {
  max-width: 1200px;
  margin: 0 auto;
}

.rca-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.rca-back-btn {
  background: rgba(75, 85, 99, 0.4);
  border: none;
  color: #d1d5db;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.rca-back-btn:hover {
  background: rgba(75, 85, 99, 0.6);
  color: white;
}

.rca-detail-title-section {
  flex: 1;
  min-width: 200px;
}

.rca-case-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
  display: inline-block;
}

.rca-detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  margin: 0;
}

.rca-detail-actions {
  display: flex;
  gap: 0.5rem;
}

/* =====================================================
   STEPS NAVIGATION
   ===================================================== */

.rca-steps-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(17, 24, 39, 0.5);
  border-radius: 12px;
  overflow-x: auto;
}

.rca-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 90px;
  text-align: center;
}

.rca-step:hover {
  background: rgba(75, 85, 99, 0.3);
}

.rca-step.active {
  background: rgba(16, 185, 129, 0.2);
}

.rca-step.completed {
  background: rgba(34, 197, 94, 0.1);
}

.rca-step-icon {
  font-size: 1.25rem;
  color: #9ca3af;
}

.rca-step.active .rca-step-icon {
  color: #10b981;
}

.rca-step.completed .rca-step-icon {
  color: #22c55e;
}

.rca-step-label {
  font-size: 0.7rem;
  color: #9ca3af;
  font-weight: 500;
}

.rca-step.active .rca-step-label {
  color: #10b981;
}

.rca-step.completed .rca-step-label {
  color: #22c55e;
}

/* =====================================================
   STEP PANEL
   ===================================================== */

.rca-step-panel {
  background: rgba(31, 41, 55, 0.8);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid rgba(75, 85, 99, 0.4);
}

.rca-step-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(75, 85, 99, 0.3);
}

.rca-step-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: white;
  margin: 0 0 0.5rem 0;
}

.rca-step-header p {
  color: #9ca3af;
  font-size: 0.875rem;
  margin: 0;
}

.rca-ai-suggestion-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(99, 102, 241, 0.1));
  border-radius: 8px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #d1d5db;
}

.rca-ai-badge {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.rca-form h3 {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  margin: 1.5rem 0 1rem 0;
}

.rca-form h3:first-child {
  margin-top: 0;
}

/* =====================================================
   SMART CRITERIA
   ===================================================== */

.rca-smart-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .rca-smart-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.rca-smart-item label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #10b981;
}

/* =====================================================
   VIEW TOGGLE
   ===================================================== */

.rca-view-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.rca-toggle-btn {
  padding: 0.625rem 1.25rem;
  background: rgba(75, 85, 99, 0.4);
  border: 1px solid rgba(75, 85, 99, 0.5);
  border-radius: 8px;
  color: #9ca3af;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rca-toggle-btn:hover {
  background: rgba(75, 85, 99, 0.6);
  color: white;
}

.rca-toggle-btn.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #10b981;
}

.rca-ai-actions {
  margin-bottom: 1rem;
}

/* =====================================================
   FISHBONE DIAGRAM
   ===================================================== */

.rca-fishbone {
  padding: 1.5rem;
  background: rgba(17, 24, 39, 0.5);
  border-radius: 12px;
  margin-bottom: 1rem;
  overflow-x: auto;
}

.rca-fishbone-diagram {
  min-width: 800px;
  position: relative;
}

.rca-fishbone-row {
  display: flex;
  justify-content: space-around;
  position: relative;
}

.rca-fishbone-top {
  margin-bottom: 2rem;
}

.rca-fishbone-bottom {
  margin-top: 2rem;
}

.rca-fishbone-category {
  width: 220px;
  text-align: center;
  position: relative;
}

.rca-fishbone-category-header {
  font-weight: 600;
  color: #10b981;
  font-size: 0.875rem;
  padding: 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.rca-fishbone-bottom .rca-fishbone-category-header {
  margin-bottom: 0;
  margin-top: 0.5rem;
}

.rca-fishbone-causes {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.5rem;
}

.rca-fishbone-cause {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 0.375rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #d1d5db;
  transition: all 0.2s ease;
  cursor: pointer;
}

.rca-fishbone-cause:hover {
  background: rgba(59, 130, 246, 0.25);
}

.rca-fishbone-cause.validated {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
}

.rca-fishbone-cause.draft {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
}

.rca-fishbone-empty {
  color: #6b7280;
  font-size: 0.75rem;
  font-style: italic;
  padding: 0.5rem;
}

.rca-fishbone-bone {
  height: 3px;
  background: linear-gradient(90deg, transparent, #10b981, transparent);
  margin: 0.5rem 0;
}

.rca-fishbone-spine {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 1rem;
}

.rca-fishbone-spine::before {
  content: '';
  flex: 1;
  height: 4px;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  border-radius: 2px;
}

.rca-fishbone-problem {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  text-align: center;
  min-width: 150px;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.rca-fishbone-problem strong {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.rca-fishbone-problem span {
  font-size: 0.875rem;
  font-weight: 500;
}

/* =====================================================
   HYPOTHESIS TREE
   ===================================================== */

.rca-hypothesis-tree {
  padding: 1rem;
  background: rgba(17, 24, 39, 0.5);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.rca-tree-node {
  position: relative;
}

.rca-tree-node::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(75, 85, 99, 0.4);
}

.rca-tree-node:last-child::before {
  height: 50%;
}

.rca-tree-node-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  position: relative;
}

.rca-tree-node-content.validated {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
}

.rca-tree-node-content.rejected {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  opacity: 0.6;
}

.rca-tree-status {
  font-size: 1rem;
}

.rca-tree-text {
  flex: 1;
  color: #d1d5db;
  font-size: 0.875rem;
}

.rca-tree-actions {
  display: flex;
  gap: 0.25rem;
}

.rca-tree-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(75, 85, 99, 0.4);
  border: none;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.rca-tree-btn:hover {
  background: rgba(75, 85, 99, 0.6);
  color: white;
}

.rca-tree-children {
  padding-left: 1.5rem;
}

/* =====================================================
   5 WHYS ANALYSIS
   ===================================================== */

.rca-five-whys-section {
  margin-bottom: 2rem;
}

.rca-five-whys-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  margin-bottom: 1rem;
}

.rca-why-chain {
  background: rgba(17, 24, 39, 0.5);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  border-left: 4px solid #10b981;
}

.rca-why-hypothesis {
  font-size: 0.875rem;
  color: #10b981;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(75, 85, 99, 0.3);
}

.rca-why-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem;
  background: rgba(75, 85, 99, 0.2);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  position: relative;
}

.rca-why-item.root-cause {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.rca-why-level {
  font-weight: 600;
  color: #f59e0b;
  font-size: 0.75rem;
  min-width: 50px;
}

.rca-why-qa {
  flex: 1;
}

.rca-why-q {
  color: #d1d5db;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.rca-why-a {
  color: #9ca3af;
  font-size: 0.875rem;
}

.rca-root-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #ef4444;
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* 5 Whys Modal */
.rca-5whys-hypothesis {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  color: #10b981;
  font-size: 0.9rem;
}

.rca-5whys-chain {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rca-5why-item {
  background: rgba(17, 24, 39, 0.5);
  padding: 1rem;
  border-radius: 8px;
  border-left: 3px solid #f59e0b;
}

.rca-5why-level {
  font-weight: 600;
  color: #f59e0b;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.rca-5why-question {
  color: white;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.rca-ai-suggestion {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
}

.rca-ai-suggestion p {
  color: #d1d5db;
  font-size: 0.875rem;
  margin: 0.5rem 0;
}

.rca-ai-suggestion button {
  margin-top: 0.5rem;
}

.rca-root-cause-found {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

/* =====================================================
   ROOT CAUSES
   ===================================================== */

.rca-root-causes-section {
  margin-top: 2rem;
}

.rca-root-causes-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  margin-bottom: 1rem;
}

.rca-root-cause-card {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  margin-bottom: 0.75rem;
}

.rca-rc-rank {
  width: 36px;
  height: 36px;
  background: rgba(239, 68, 68, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  font-weight: 700;
  flex-shrink: 0;
}

.rca-rc-content {
  flex: 1;
}

.rca-rc-content h4 {
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.rca-rc-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
}

.rca-rc-category {
  color: #9ca3af;
  background: rgba(75, 85, 99, 0.4);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.rca-rc-impact {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

.rca-rc-impact.rca-impact-high,
.rca-action-impact.rca-impact-high {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.rca-rc-impact.rca-impact-medium,
.rca-action-impact.rca-impact-medium {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.rca-rc-impact.rca-impact-low,
.rca-action-impact.rca-impact-low {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

/* =====================================================
   ACTION PLAN
   ===================================================== */

.rca-actions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.rca-action-card {
  background: rgba(17, 24, 39, 0.5);
  border: 1px solid rgba(75, 85, 99, 0.4);
  border-radius: 10px;
  padding: 1rem;
}

.rca-action-card.rca-action-completed {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.05);
}

.rca-action-card.rca-action-in_progress {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.05);
}

.rca-action-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.rca-action-type {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.rca-action-type.corrective {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.rca-action-type.preventive {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.rca-action-status {
  font-size: 0.75rem;
  color: #9ca3af;
}

.rca-action-text {
  color: white;
  font-size: 0.9rem;
  margin: 0 0 0.75rem 0;
}

.rca-action-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 0.75rem;
}

.rca-action-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rca-action-progress .rca-progress-bar {
  flex: 1;
}

.rca-action-progress span {
  font-size: 0.75rem;
  color: #10b981;
  font-weight: 600;
}

/* =====================================================
   MONITORING
   ===================================================== */

.rca-monitoring-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .rca-monitoring-summary {
    grid-template-columns: 1fr;
  }
}

.rca-monitoring-card {
  background: rgba(17, 24, 39, 0.5);
  border-radius: 12px;
  padding: 1.25rem;
  border: 1px solid rgba(75, 85, 99, 0.4);
}

.rca-monitoring-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #9ca3af;
  margin: 0 0 1rem 0;
}

.rca-big-progress {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.rca-progress-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: conic-gradient(#10b981 0% var(--progress, 0%), rgba(75, 85, 99, 0.4) var(--progress, 0%) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.rca-progress-circle::before {
  content: '';
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgb(17, 24, 39);
}

.rca-progress-circle span {
  position: relative;
  font-size: 1.25rem;
  font-weight: 700;
  color: #10b981;
}

.rca-progress-stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rca-progress-stats div {
  color: #d1d5db;
  font-size: 0.875rem;
}

.rca-progress-stats strong {
  color: white;
  margin-right: 0.25rem;
}

.rca-kpi-display {
  text-align: center;
}

.rca-kpi-name {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  margin-bottom: 0.75rem;
}

.rca-kpi-values {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.rca-kpi-baseline,
.rca-kpi-target {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.rca-kpi-baseline {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.rca-kpi-target {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.rca-kpi-arrow {
  color: #9ca3af;
  font-size: 1.25rem;
}

.rca-standardization {
  margin-bottom: 1.5rem;
}

.rca-standardization h3 {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  margin-bottom: 1rem;
}

.rca-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rca-check-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(17, 24, 39, 0.5);
  border-radius: 8px;
  color: #d1d5db;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rca-check-item:hover {
  background: rgba(75, 85, 99, 0.3);
}

.rca-check-item input[type="checkbox"] {
  accent-color: #10b981;
  width: 18px;
  height: 18px;
}

/* =====================================================
   AI CHAT
   ===================================================== */

.rca-ai-chat-messages {
  height: calc(100% - 70px);
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rca-ai-message {
  max-width: 85%;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  font-size: 0.875rem;
}

.rca-ai-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border-bottom-right-radius: 4px;
}

.rca-ai-message.assistant {
  align-self: flex-start;
  background: rgba(75, 85, 99, 0.4);
  color: #d1d5db;
  border-bottom-left-radius: 4px;
}

.rca-ai-message p {
  margin: 0;
  line-height: 1.5;
}

.rca-ai-message ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.rca-ai-message li {
  margin: 0.25rem 0;
}

.rca-ai-message.error {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.rca-ai-chat-input {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid rgba(75, 85, 99, 0.4);
}

.rca-ai-chat-input .rca-input {
  flex: 1;
}

/* =====================================================
   EMPTY & LOADING STATES
   ===================================================== */

.rca-empty-message {
  color: #6b7280;
  font-size: 0.875rem;
  text-align: center;
  padding: 2rem;
  font-style: italic;
}

/* =====================================================
   RESPONSIVE ADJUSTMENTS
   ===================================================== */

@media (max-width: 768px) {
  .rca-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .rca-detail-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .rca-steps-container {
    padding: 0.75rem;
  }
  
  .rca-step {
    min-width: 70px;
    padding: 0.5rem;
  }
  
  .rca-step-label {
    font-size: 0.6rem;
  }
}
