/* QuantumStream - Component Library */

/* Cards */
.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow);
  margin-bottom: var(--spacing-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
}

/* KPI Tiles */
.kpi-tile {
  background: var(--panel-elev);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  text-align: center;
}

.kpi-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--spacing-sm);
}

.kpi-label {
  font-size: 14px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-delta {
  font-size: 12px;
  margin-top: var(--spacing-sm);
}

.kpi-delta.up { color: var(--good); }
.kpi-delta.down { color: var(--bad); }

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-critical { background: var(--bad); color: #0b1020; }
.badge-high { background: #ff9a5a; color: #0b1020; }
.badge-warning { background: var(--warn); color: #0b1020; }
.badge-info { background: var(--info); color: #0b1020; }
.badge-success { background: var(--good); color: #0b1020; }
.badge-drate { background: #ff4757; color: white; }

/* Pills (Metadata) */
.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  background: rgba(122, 183, 255, 0.15);
  color: var(--accent);
  margin-right: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-block;
}

.btn-primary {
  background: var(--accent);
  color: #0b1020;
}

.btn-primary:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(122, 183, 255, 0.1);
  transform: translateY(-2px);
  border-color: var(--accent-2);
  box-shadow: 0 4px 12px rgba(122, 183, 255, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
}

.btn-ghost:hover {
  background: rgba(122, 183, 255, 0.1);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: var(--panel-elev);
  position: sticky;
  top: 0;
  z-index: 10;
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.table tbody tr {
  transition: background 0.2s;
  cursor: pointer;
}

.table tbody tr:hover {
  background: rgba(122, 183, 255, 0.05);
}

.table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

/* Forms */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  font-family: var(--font);
}

.form-control:focus {
  border-color: var(--accent);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
  padding: var(--spacing-md);
  background: var(--panel);
  border-radius: var(--radius);
  margin-bottom: var(--spacing-lg);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.filter-group label {
  font-size: 12px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
  padding: 8px 12px;
  background: var(--panel-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--line);
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
  background-color: var(--accent);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

/* Tooltips */
.tooltip {
  position: absolute;
  background: var(--panel-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--spacing-sm);
  font-size: 12px;
  pointer-events: none;
  z-index: 1000;
  box-shadow: var(--shadow);
  display: none;
}

.tooltip.active {
  display: block;
}

/* D3 US Map Styles */
.state-boundary {
  transition: fill 0.2s ease, opacity 0.2s ease;
}

.state-boundary:hover {
  fill-opacity: 1;
  filter: brightness(1.1);
}

.state-circle {
  transition: all 0.2s ease;
}

.state-circle:hover {
  opacity: 1 !important;
  stroke-width: 3 !important;
  filter: brightness(1.3);
}

/* Pagination Controls */
#prediction-pagination {
  background: var(--panel);
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#prediction-pagination .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

#prediction-pagination .btn:not(.btn-primary):not([disabled]):hover {
  background: var(--panel-elev);
  transform: translateY(-1px);
}

#prediction-pagination .btn-primary {
  background: var(--accent);
  color: var(--panel);
  font-weight: 600;
}

/* Animated Pipeline Flow */
.pipeline-arrow {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  height: 3px;
  background: linear-gradient(90deg, 
    var(--accent) 0%, 
    var(--accent) 50%, 
    transparent 50%, 
    transparent 100%);
  background-size: 20px 3px;
  animation: flowRight 1.5s linear infinite;
  z-index: 10;
  margin: 0 -4px;
}

.pipeline-arrow::after {
  content: '▶';
  position: absolute;
  right: -12px;
  font-size: 18px;
  color: var(--accent);
  animation: pulse 2s ease-in-out infinite;
  z-index: 20;
  filter: drop-shadow(0 0 4px rgba(122, 183, 255, 0.5));
}

@keyframes flowRight {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 20px 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* Pipeline Stage Box */
.pipeline-stage {
  flex: 1;
  background: var(--panel);
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid var(--accent);
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pipeline-stage:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(122, 183, 255, 0.3);
}

.pipeline-stage:nth-child(3) {
  border-left-color: var(--accent-2);
}

.pipeline-stage:nth-child(5) {
  border-left-color: var(--good);
}

.pipeline-stage:nth-child(7) {
  border-left-color: var(--warn);
}

.pipeline-stage:nth-child(9) {
  border-left-color: var(--accent);
}

.pipeline-stage-number {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 14px;
}

.pipeline-stage-tech {
  font-size: 11px;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.pipeline-stage-metric {
  font-size: 13px;
  margin-top: 8px;
}

.pipeline-stage-metric strong {
  color: var(--accent);
  font-size: 16px;
}

.pipeline-container {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 20px;
  background: var(--panel-elev);
  border-radius: var(--radius);
  overflow-x: auto;
}

/* Compact Table Styles */
.table-compact {
  font-size: 13px;
}

.table-compact thead th {
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.table-compact tbody td {
  padding: 8px 12px;
  line-height: 1.3;
}

.table-compact tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.table-compact tbody tr:hover {
  background: var(--panel-elev);
}

.table-compact tbody tr.selected {
  background: var(--panel-elev);
  border-left: 3px solid var(--accent);
}

/* Loading Spinner */
.spinner {
  border: 3px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--panel-elev);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--spacing-md);
  box-shadow: var(--shadow);
  z-index: 2000;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}


/* ========== iQ-AI Toggle Switches ========== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--line);
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

/* ============= QS-iQ STYLES ============= */

/* Floating Button */
.qs-iq-float-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, #7ab7ff 0%, #3ec9d6 100%);
  border: none;
  box-shadow: 0 2px 8px rgba(122, 183, 255, 0.3);
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.qs-iq-float-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(122, 183, 255, 0.5);
  background: linear-gradient(135deg, #8ac4ff 0%, #4ed9e6 100%);
}

.qs-iq-float-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(122, 183, 255, 0.3);
}

.qs-iq-float-btn i {
  color: #ffd93d !important;
}

.qs-iq-btn-text {
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
}

@keyframes qs-iq-pulse {
  0%, 100% {
    box-shadow: 0 8px 32px rgba(122, 183, 255, 0.5);
  }
  50% {
    box-shadow: 0 8px 32px rgba(122, 183, 255, 0.8), 0 0 0 12px rgba(122, 183, 255, 0.1);
  }
}

/* Feature Cards */
.qs-iq-feature-card {
  background: var(--panel-elev);
  border-radius: var(--radius);
  padding: 32px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
}

.qs-iq-feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(122, 183, 255, 0.05), rgba(62, 201, 214, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.qs-iq-feature-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 16px 48px rgba(122, 183, 255, 0.3);
}

.qs-iq-feature-card:hover::before {
  opacity: 1;
}

.qs-iq-feature-card:active {
  transform: translateY(-4px) scale(1.01);
}

.qs-iq-feature-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.qs-iq-feature-card:hover .qs-iq-feature-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 24px rgba(122, 183, 255, 0.4);
}

.qs-iq-feature-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--ink);
  position: relative;
  z-index: 1;
}

.qs-iq-feature-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-muted);
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.qs-iq-feature-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(94, 230, 168, 0.2);
  color: var(--good);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
}

.qs-iq-explore-btn {
  position: absolute;
  bottom: 32px;
  right: 32px;
  padding: 10px 24px;
  background: var(--accent);
  color: #0b1020;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  cursor: pointer;
  z-index: 2;
}

.qs-iq-feature-card:hover .qs-iq-explore-btn {
  opacity: 1;
  transform: translateY(0);
}

.qs-iq-explore-btn:hover {
  background: var(--accent-2);
  transform: translateY(-2px);
}

/* Hero Section */
.qs-iq-hero {
  text-align: center;
  padding: 60px 0 40px 0;
  position: relative;
}

.qs-iq-hero-icon {
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 48px rgba(122, 183, 255, 0.4);
  animation: qs-iq-float 3s ease-in-out infinite;
}

@keyframes qs-iq-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.qs-iq-hero-title {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.qs-iq-hero-subtitle {
  font-size: 20px;
  color: var(--ink-muted);
  margin-bottom: 12px;
  font-weight: 500;
}

.qs-iq-hero-desc {
  font-size: 16px;
  color: var(--ink-muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Detail Page */
.qs-iq-detail-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--line);
}

.qs-iq-back-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--panel-elev);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.qs-iq-back-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateX(-4px);
}

.qs-iq-detail-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(122, 183, 255, 0.3);
}

.qs-iq-detail-title {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 8px;
}

.qs-iq-detail-subtitle {
  font-size: 16px;
  color: var(--ink-muted);
}

/* Loading Animation */
@keyframes qs-iq-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.qs-iq-loading {
  display: inline-block;
  animation: qs-iq-spin 1s linear infinite;
}

/* ============================================
   VEHICLE ONBOARDING WIZARD
   ============================================ */

.wizard-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 16, 32, 0.95);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.wizard-content {
  background: var(--panel);
  border-radius: var(--radius);
  max-width: 1200px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--line);
  overflow: hidden;
}

.wizard-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-elev);
}

.wizard-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.wizard-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.wizard-close:hover {
  background: var(--panel);
  color: var(--ink);
}

.wizard-progress {
  padding: 24px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-elev);
}

.wizard-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.wizard-steps::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--line);
  z-index: 0;
}

.wizard-step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.wizard-step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-muted);
  transition: all 0.3s;
}

.wizard-step-indicator.active .wizard-step-number {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b1020;
  box-shadow: 0 0 20px rgba(122, 183, 255, 0.5);
}

.wizard-step-indicator.completed .wizard-step-number {
  background: var(--good);
  border-color: var(--good);
  color: #0b1020;
}

.wizard-step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  text-align: center;
  max-width: 100px;
  line-height: 1.3;
}

.wizard-step-indicator.active .wizard-step-label {
  color: var(--accent);
}

.wizard-step-indicator.completed .wizard-step-label {
  color: var(--good);
}

.wizard-body {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.wizard-step-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.wizard-step-content.active {
  display: block;
}

.wizard-step-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wizard-step-desc {
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0 0 24px 0;
  line-height: 1.5;
}

.wizard-nav {
  padding: 20px 32px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel-elev);
}

/* Certificate Upload Zone */
.cert-upload-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  background: var(--panel-elev);
  cursor: pointer;
  transition: all 0.3s;
}

.cert-upload-zone:hover {
  border-color: var(--accent);
  background: rgba(122, 183, 255, 0.05);
}

.cert-upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(122, 183, 255, 0.1);
}

.cert-upload-zone.has-file {
  border-style: solid;
  border-color: var(--good);
  background: rgba(94, 230, 168, 0.05);
}

/* Agent Profile Cards */
.agent-profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.agent-profile-card {
  background: var(--panel-elev);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.agent-profile-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(122, 183, 255, 0.2);
}

.agent-profile-card.selected {
  border-color: var(--accent);
  background: rgba(122, 183, 255, 0.1);
  box-shadow: 0 0 0 4px rgba(122, 183, 255, 0.1);
}

.agent-profile-card.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #0b1020;
}

.agent-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.agent-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-card-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.agent-card-desc {
  font-size: 12px;
  color: var(--ink-muted);
  margin: 0 0 12px 0;
}

.agent-card-specs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
}

.agent-card-spec {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: var(--panel);
  border-radius: 4px;
}

.agent-card-spec-label {
  color: var(--ink-muted);
}

.agent-card-spec-value {
  font-weight: 600;
  color: var(--ink);
}

/* Signal Tree */
.signal-tree {
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-elev);
}

.signal-domain {
  border-bottom: 1px solid var(--line);
}

.signal-domain:last-child {
  border-bottom: none;
}

.signal-domain-header {
  padding: 12px 16px;
  background: var(--panel);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.2s;
}

.signal-domain-header:hover {
  background: rgba(122, 183, 255, 0.05);
}

.signal-domain-header.expanded {
  background: rgba(122, 183, 255, 0.08);
}

.signal-domain-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.signal-domain-chevron {
  margin-left: auto;
  transition: transform 0.3s;
}

.signal-domain-header.expanded .signal-domain-chevron {
  transform: rotate(90deg);
}

.signal-list {
  display: none;
  padding: 8px;
}

.signal-list.expanded {
  display: block;
}

.signal-item {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  border-radius: 4px;
  transition: background 0.2s;
}

.signal-item:hover {
  background: rgba(122, 183, 255, 0.05);
}

.signal-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.signal-name {
  flex: 1;
  font-weight: 500;
}

.signal-unit {
  color: var(--ink-muted);
  font-size: 11px;
}

.signal-dbc {
  background: var(--panel);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  color: var(--ink-muted);
}

/* Deployment Status Card */
.deployment-status-card {
  background: var(--panel-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.deployment-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.deployment-vin {
  font-size: 16px;
  font-weight: 700;
}

.deployment-model {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.deployment-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.deployment-status.pending {
  background: rgba(255, 159, 67, 0.15);
  color: var(--warn);
}

.deployment-status.deploying {
  background: rgba(122, 183, 255, 0.15);
  color: var(--accent);
}

.deployment-status.complete {
  background: rgba(94, 230, 168, 0.15);
  color: var(--good);
}

.deployment-status.error {
  background: rgba(255, 71, 87, 0.15);
  color: var(--bad);
}

.deployment-agents {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.deployment-agent {
  background: var(--panel);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.deployment-agent-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.deployment-agent-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
}

.deployment-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--panel-elev);
  border-radius: 3px;
  overflow: hidden;
}

.deployment-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.5s ease;
}

.deployment-progress-fill.complete {
  background: var(--good);
}

.deployment-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.deployment-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.deployment-metric-label {
  color: var(--ink-muted);
}

.deployment-metric-value {
  font-weight: 600;
  color: var(--ink);
}

/* VIN Input Group */
.vin-input-group {
  margin-bottom: 24px;
}

.vin-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
  background: var(--panel-elev);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  transition: all 0.3s;
}

.vin-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(122, 183, 255, 0.1);
}

.vin-input.valid {
  border-color: var(--good);
}

.vin-input.invalid {
  border-color: var(--bad);
}

.vin-validation-message {
  margin-top: 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vin-validation-message.error {
  color: var(--bad);
}

.vin-validation-message.success {
  color: var(--good);
}

/* Bulk Upload */
.bulk-upload-container {
  display: none;
}

.bulk-upload-container.active {
  display: block;
}

.csv-example {
  background: var(--panel);
  padding: 12px;
  border-radius: var(--radius);
  font-family: 'Courier New', monospace;
  font-size: 11px;
  margin-top: 12px;
  border: 1px solid var(--line);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ============================================
   VEHICLE WIREFRAME VISUALIZER
   ============================================ */

/* Visualizer Wrapper */
.vehicle-visualizer-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header with component badge */
.vehicle-visualizer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.visualizer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.visualizer-component-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--panel-elev);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.component-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
  animation: pulse-indicator 2s ease-in-out infinite;
}

@keyframes pulse-indicator {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

.component-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

/* SVG Container */
.vehicle-wireframe-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
  padding: 20px;
  background: linear-gradient(135deg, var(--panel-elev) 0%, var(--panel) 100%);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

/* SVG Styling */
.vehicle-wireframe {
  max-width: 100%;
  height: auto;
  color: var(--ink-muted);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

/* Component Highlight Animation - Enhanced for new SVG design */
@keyframes component-pulse {
  0%, 100% {
    opacity: 1;
    filter: drop-shadow(0 0 6px currentColor);
  }
  50% {
    opacity: 0.80;
    filter: drop-shadow(0 0 16px currentColor);
  }
}

.component-highlight {
  animation: component-pulse 2s ease-in-out infinite;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.component-active {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* SVG Component Transitions */
.vehicle-component {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.vehicle-component:hover {
  opacity: 0.9;
}

/* Severity Legend */
.severity-legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: 12px;
  background: var(--panel-elev);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-muted);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Loading State */
.loading-spinner {
  font-size: 14px;
  color: var(--ink-muted);
  text-align: center;
  animation: pulse 1.5s ease-in-out infinite;
}

/* Error State */
.visualization-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-muted);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .vehicle-visualizer-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .severity-legend {
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .vehicle-wireframe-container {
    min-height: 220px;
    padding: 12px;
  }
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .component-highlight,
  .component-indicator,
  .loading-spinner {
    animation: none;
  }
}

/* ============================================
   FLEET OPS CONSOLE 360 MODERN STYLES
   ============================================ */

/* Hero Section - Compact Version with Enhanced Visibility */
.fleet-hero {
  text-align: center;
  padding: 20px 0 16px 0;
  position: relative;
  margin-bottom: 24px;
}

.fleet-hero-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 36px rgba(122, 183, 255, 0.5);
  animation: fleet-float 3s ease-in-out infinite;
}

@keyframes fleet-float {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 12px 36px rgba(122, 183, 255, 0.5);
  }
  50% {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(122, 183, 255, 0.6);
  }
}

.fleet-hero-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 8px rgba(122, 183, 255, 0.3);
}

.fleet-hero-subtitle {
  font-size: 13px;
  color: #b6c5e3;
  font-weight: 500;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Modern KPI Tiles - Enhanced Visibility */
.kpi-tile-modern {
  background: var(--panel-elev);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(122, 183, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(122, 183, 255, 0.1);
}

.kpi-tile-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(122, 183, 255, 0.05), rgba(62, 201, 214, 0.05));
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 0;
}

.kpi-tile-modern::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 2;
}

.kpi-tile-modern:hover {
  transform: translateY(-8px) scale(1.03);
  border-color: var(--accent);
  box-shadow: 0 20px 56px rgba(122, 183, 255, 0.4), inset 0 0 0 1px rgba(122, 183, 255, 0.3);
}

.kpi-tile-modern:hover::before {
  opacity: 1;
}

.kpi-tile-modern:hover::after {
  opacity: 1;
  animation: shimmer-sweep 1.5s ease-in-out;
}

@keyframes shimmer-sweep {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.kpi-icon {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  transition: all 0.25s ease;
  position: relative;
  z-index: 1;
  animation: kpi-icon-pulse 2s ease-in-out infinite;
}

/* Color Variants for KPI Icons */
.kpi-icon-blue {
  background: linear-gradient(135deg, #7ab7ff 0%, #3ec9d6 100%);
  animation: kpi-icon-pulse-blue 2s ease-in-out infinite;
}

.kpi-icon-green {
  background: linear-gradient(135deg, #5ee6a8 0%, #3ec9d6 100%);
  animation: kpi-icon-pulse-green 2s ease-in-out infinite;
}

.kpi-icon-purple {
  background: linear-gradient(135deg, #a78bfa 0%, #7ab7ff 100%);
  animation: kpi-icon-pulse-purple 2s ease-in-out infinite;
}

.kpi-icon-orange {
  background: linear-gradient(135deg, #ffa726 0%, #ff7043 100%);
  animation: kpi-icon-pulse-orange 2s ease-in-out infinite;
}

/* Color-Specific Pulse Animations */
@keyframes kpi-icon-pulse {
  0%, 100% {
    box-shadow: 0 6px 24px rgba(122, 183, 255, 0.4);
  }
  50% {
    box-shadow: 0 8px 32px rgba(122, 183, 255, 0.6);
  }
}

@keyframes kpi-icon-pulse-blue {
  0%, 100% {
    box-shadow: 0 6px 24px rgba(122, 183, 255, 0.4);
  }
  50% {
    box-shadow: 0 8px 32px rgba(122, 183, 255, 0.6);
  }
}

@keyframes kpi-icon-pulse-green {
  0%, 100% {
    box-shadow: 0 6px 24px rgba(94, 230, 168, 0.4);
  }
  50% {
    box-shadow: 0 8px 32px rgba(94, 230, 168, 0.6);
  }
}

@keyframes kpi-icon-pulse-purple {
  0%, 100% {
    box-shadow: 0 6px 24px rgba(167, 139, 250, 0.4);
  }
  50% {
    box-shadow: 0 8px 32px rgba(167, 139, 250, 0.6);
  }
}

@keyframes kpi-icon-pulse-orange {
  0%, 100% {
    box-shadow: 0 6px 24px rgba(255, 167, 38, 0.4);
  }
  50% {
    box-shadow: 0 8px 32px rgba(255, 167, 38, 0.6);
  }
}

/* Color-Specific Hover Effects */
.kpi-tile-modern:hover .kpi-icon {
  transform: scale(1.15) rotate(5deg);
}

.kpi-tile-modern:hover .kpi-icon-blue {
  box-shadow: 0 12px 40px rgba(122, 183, 255, 0.7);
}

.kpi-tile-modern:hover .kpi-icon-green {
  box-shadow: 0 12px 40px rgba(94, 230, 168, 0.7);
}

.kpi-tile-modern:hover .kpi-icon-purple {
  box-shadow: 0 12px 40px rgba(167, 139, 250, 0.7);
}

.kpi-tile-modern:hover .kpi-icon-orange {
  box-shadow: 0 12px 40px rgba(255, 167, 38, 0.7);
}

.kpi-value-modern {
  font-size: 42px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.kpi-label-modern {
  font-size: 13px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.kpi-delta-modern {
  font-size: 11px;
  margin-top: 8px;
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.kpi-delta-modern.up { 
  color: var(--good); 
  background: rgba(94, 230, 168, 0.15);
}

.kpi-delta-modern.down { 
  color: var(--bad);
  background: rgba(255, 122, 122, 0.15);
}

/* Modern Card Styles - Enhanced Visibility */
.card-modern {
  background: var(--panel);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  margin-bottom: var(--spacing-md);
  border: 1px solid rgba(122, 183, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(122, 183, 255, 0.1);
  transition: all 0.25s ease;
}

.card-modern:hover {
  box-shadow: 0 12px 32px rgba(122, 183, 255, 0.2), inset 0 0 0 1px rgba(122, 183, 255, 0.25);
  border-color: rgba(122, 183, 255, 0.4);
  transform: translateY(-2px);
}

.card-modern .card-header-modern {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.card-header-modern {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.card-title-modern {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title-icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

/* Gradient Buttons - Enhanced Visibility */
.btn-gradient {
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #0b1020;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(122, 183, 255, 0.4);
  position: relative;
  overflow: hidden;
}

.btn-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.btn-gradient:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 28px rgba(122, 183, 255, 0.5);
}

.btn-gradient:hover::before {
  left: 100%;
}

.btn-gradient:active {
  transform: translateY(-1px) scale(1.01);
}

/* Modern Badges with Glow */
.badge-modern {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.badge-modern:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(122, 183, 255, 0.3);
}

.badge-modern .badge-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 4px currentColor;
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 8px currentColor;
    opacity: 0.8;
  }
}

/* Modern Pills - Enhanced Visibility */
.pill-modern {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 16px;
  font-size: 13px;
  background: rgba(122, 183, 255, 0.12);
  border: 1px solid rgba(122, 183, 255, 0.3);
  color: var(--accent);
  margin-right: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(122, 183, 255, 0.15);
}

.pill-modern:hover {
  background: rgba(122, 183, 255, 0.2);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(122, 183, 255, 0.25);
}

/* Shimmer Animation for loading states */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--panel-elev) 0%,
    rgba(122, 183, 255, 0.1) 50%,
    var(--panel-elev) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* Enhanced Table Cards */
.table-card-modern {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid rgba(122, 183, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(122, 183, 255, 0.1);
  transition: all 0.25s ease;
  margin-bottom: var(--spacing-md);
}

.table-card-modern:hover {
  box-shadow: 0 12px 32px rgba(122, 183, 255, 0.2), inset 0 0 0 1px rgba(122, 183, 255, 0.25);
  border-color: rgba(122, 183, 255, 0.4);
  transform: translateY(-2px);
}

.table-card-modern .card-header-modern {
  padding: var(--spacing-lg);
  margin-bottom: 0;
}

.table-card-modern .table-wrapper {
  /* No overflow hidden on table cards to allow table scrolling */
}

.table-card-modern .table tbody tr:hover {
  background: rgba(122, 183, 255, 0.08);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .fleet-hero {
    padding: 16px 0 12px 0;
    margin-bottom: 20px;
  }
  
  .fleet-hero-title {
    font-size: 24px;
  }
  
  .fleet-hero-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    margin: 0 auto 10px;
  }
  
  .fleet-hero-icon i {
    width: 36px !important;
    height: 36px !important;
  }
  
  .fleet-hero-subtitle {
    font-size: 12px;
  }
  
  .kpi-tile-modern {
    padding: 24px 16px;
  }
  
  .kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
  }
  
  .kpi-icon i {
    width: 28px !important;
    height: 28px !important;
  }
  
  .kpi-value-modern {
    font-size: 36px;
  }
}

/* Accessibility: Reduced Motion for Fleet Ops Modern Styles */
@media (prefers-reduced-motion: reduce) {
  .fleet-hero-icon,
  .kpi-icon,
  .kpi-icon-blue,
  .kpi-icon-green,
  .kpi-icon-purple,
  .kpi-icon-orange,
  .kpi-tile-modern,
  .kpi-tile-modern::before,
  .kpi-tile-modern::after,
  .card-modern,
  .btn-gradient,
  .btn-gradient::before,
  .badge-modern,
  .pill-modern,
  .table-card-modern {
    animation: none !important;
    transition: none !important;
  }
  
  .kpi-tile-modern:hover,
  .btn-gradient:hover,
  .btn-secondary:hover,
  .badge-modern:hover,
  .pill-modern:hover,
  .card-modern:hover,
  .table-card-modern:hover {
    transform: none !important;
  }
}

/* ============================================
   AUTHENTICATION SYSTEM
   ============================================ */

/* Auth Overlay - Full screen backdrop */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 16, 32, 0.98);
  backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: authFadeIn 0.4s ease;
}

@keyframes authFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Auth Modal Card */
.auth-modal {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 
              0 0 0 1px rgba(122, 183, 255, 0.2);
  max-width: 420px;
  width: 100%;
  padding: 48px 40px;
  animation: authSlideUp 0.4s ease;
  border: 1px solid rgba(122, 183, 255, 0.3);
}

@keyframes authSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Auth Header */
.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  display: block;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(122, 183, 255, 0.3);
  animation: authLogoPulse 2s ease-in-out infinite;
}

@keyframes authLogoPulse {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(122, 183, 255, 0.3);
  }
  50% {
    box-shadow: 0 8px 32px rgba(122, 183, 255, 0.5);
  }
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px 0;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0;
  font-weight: 500;
}

/* Auth Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--panel-elev);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 15px;
  font-family: var(--font);
  transition: all 0.3s ease;
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(122, 183, 255, 0.15);
  background: var(--panel);
}

.auth-input::placeholder {
  color: var(--ink-muted);
  opacity: 0.5;
}

/* Auth Error Message */
.auth-error {
  padding: 12px 16px;
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.3);
  border-radius: var(--radius);
  color: var(--bad);
  font-size: 13px;
  text-align: center;
  animation: authShake 0.4s ease;
}

@keyframes authShake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}

/* Auth Button */
.auth-button {
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #0b1020;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(122, 183, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(122, 183, 255, 0.6);
}

.auth-button:active {
  transform: translateY(0);
}

/* Auth Footer */
.auth-footer {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.auth-footer p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-muted);
}

/* Logout Button */
.logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid rgba(122, 183, 255, 0.3);
  border-radius: var(--radius);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 13px;
  font-weight: 500;
  margin-left: 16px;
}

.logout-btn:hover {
  background: rgba(122, 183, 255, 0.1);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.logout-btn:active {
  transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .auth-modal {
    padding: 36px 28px;
    max-width: 360px;
  }
  
  .auth-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
  }
  
  .auth-title {
    font-size: 20px;
  }
  
  .auth-subtitle {
    font-size: 13px;
  }
  
  .logout-btn {
    padding: 6px 12px;
    font-size: 13px;
    margin-left: 12px;
  }
  
  .logout-text {
    display: none;
  }
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .auth-overlay,
  .auth-modal,
  .auth-logo,
  .auth-button,
  .auth-error,
  .logout-btn {
    animation: none !important;
    transition: none !important;
  }
  
  .auth-button:hover,
  .logout-btn:hover {
    transform: none !important;
  }
}

/* ============================================= */
/* PREDICTION PAGE - MODERN METRIC CARDS */
/* ============================================= */

.prediction-metric-card {
  flex: 1;
  min-width: 180px;
  padding: 20px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.prediction-metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.05), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.prediction-metric-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.prediction-metric-card:hover::before {
  opacity: 1;
}

/* Responsive Grid for Prediction Metrics */
@media (max-width: 1400px) {
  .prediction-metric-card {
    min-width: 160px;
    padding: 16px;
  }
}

@media (max-width: 1024px) {
  .prediction-metric-card {
    min-width: 140px;
    padding: 14px;
  }
}

@media (max-width: 768px) {
  .prediction-metric-card {
    min-width: 100%;
  }
}

/* ============================================= */
/* RCA PAGE COMPACT REDESIGN - Ultra Dense Layout */
/* ============================================= */

/* Inline Metrics Strip (Grafana-style) */
.rca-metrics-strip {
  display: flex;
  gap: 0;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.rca-inline-metric {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  border-right: 1px solid var(--line);
  min-width: 0;
}

.rca-inline-metric:last-child {
  border-right: none;
}

.rca-inline-metric-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.rca-inline-metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.rca-inline-metric-sparkline {
  height: 20px;
  margin-top: 4px;
}

.rca-inline-metric-delta {
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
}

.rca-inline-metric-delta.positive {
  color: var(--good);
}

.rca-inline-metric-delta.negative {
  color: var(--bad);
}

/* Primary Grid (2 columns) */
.rca-primary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* RCA Flow Container - Vertical Flowchart */
.rca-flow-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 8px;
  position: relative;
  min-height: auto;
  box-sizing: border-box;
}

/* Flow Node - Event Box */
.rca-flow-node {
  background: var(--panel-elev);
  border: 2px solid;
  border-radius: 6px;
  padding: 14px 18px;
  position: relative;
  transition: all 0.2s ease;
  min-height: 85px;
  max-width: 380px;
  width: fit-content;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 auto;
}

.rca-flow-node:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(122, 183, 255, 0.2);
}

/* Node Type Colors */
.rca-flow-node.node-precondition {
  border-color: #5ee6a8;
  background: linear-gradient(135deg, rgba(94, 230, 168, 0.05) 0%, var(--panel-elev) 100%);
}

.rca-flow-node.node-signal {
  border-color: #7ab7ff;
  background: linear-gradient(135deg, rgba(122, 183, 255, 0.05) 0%, var(--panel-elev) 100%);
}

.rca-flow-node.node-latent {
  border-color: #ffd77a;
  background: linear-gradient(135deg, rgba(255, 215, 122, 0.05) 0%, var(--panel-elev) 100%);
}

.rca-flow-node.node-event {
  border-color: #ff4757;
  background: linear-gradient(135deg, rgba(255, 71, 87, 0.05) 0%, var(--panel-elev) 100%);
}

.rca-flow-node.node-outcome {
  border-color: #b794f6;
  background: linear-gradient(135deg, rgba(183, 148, 246, 0.05) 0%, var(--panel-elev) 100%);
}

/* Node Header - Event Title */
.rca-flow-node-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 4px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding-right: 50px; /* Space for confidence badge */
}

/* Node Details - Component + Signals */
.rca-flow-node-details {
  font-size: 10px;
  color: var(--ink-muted);
  line-height: 1.4;
}

.rca-flow-node-component {
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 2px;
}

.rca-flow-node-signals {
  font-family: monospace;
  font-size: 9px;
  color: var(--ink-muted);
  opacity: 0.8;
}

/* Node Badge - Confidence */
.rca-flow-node-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(122, 183, 255, 0.25);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  box-shadow: 0 2px 6px rgba(122, 183, 255, 0.2);
}

.rca-flow-node-badge.high-confidence {
  background: rgba(94, 230, 168, 0.2);
  border-color: #5ee6a8;
  color: #5ee6a8;
}

.rca-flow-node-badge.low-confidence {
  background: rgba(255, 215, 122, 0.2);
  border-color: #ffd77a;
  color: #ffd77a;
}

/* Flow Arrow - Connector */
.rca-flow-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  position: relative;
}

.rca-flow-arrow-line {
  width: 2px;
  height: 12px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent) 100%);
  position: relative;
}

.rca-flow-arrow-line::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid var(--accent);
}

.rca-flow-arrow-label {
  font-size: 8px;
  color: var(--ink-muted);
  font-weight: 600;
  background: var(--panel);
  padding: 2px 6px;
  border-radius: 3px;
  margin-top: 1px;
  white-space: nowrap;
}

.rca-flow-arrow.risky .rca-flow-arrow-line {
  background: linear-gradient(180deg, #ff4757 0%, #ff4757 100%);
}

.rca-flow-arrow.risky .rca-flow-arrow-line::after {
  border-top-color: #ff4757;
}

/* Flow Branch - Parallel Paths */
.rca-flow-branch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0;
}

.rca-flow-branch .rca-flow-node {
  min-height: 80px;
}

/* Responsive Adjustments */
@media (max-width: 1400px) {
  .rca-flow-branch {
    grid-template-columns: 1fr;
  }
}

/* RCA Heatmap Table - Ultra Compact */
.rca-heatmap-wrapper {
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.rca-heatmap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  table-layout: auto;
  margin-bottom: 6px;
}

.rca-heatmap-corner {
  width: 150px;
  min-width: 150px;
  background: var(--panel);
  border: none;
  padding: 0;
}

.rca-heatmap-header {
  background: var(--panel);
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 8px 6px;
  text-align: center;
  border: 1px solid var(--line);
  vertical-align: top;
  white-space: normal !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow: visible;
  line-height: 1.4;
  height: auto;
  min-height: 50px;
  max-width: 120px;
}

.rca-heatmap-row-label {
  background: var(--panel);
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 8px 10px;
  text-align: right;
  border: 1px solid var(--line);
  white-space: normal !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow: visible;
  line-height: 1.4;
  width: 150px;
  min-width: 150px;
  max-width: 150px;
  vertical-align: middle;
}

.rca-heatmap-cell {
  text-align: center;
  padding: 0;
  border: 1px solid var(--line);
  position: relative;
  height: 24px;
  min-height: 24px;
  max-height: 24px;
  transition: all 0.2s ease;
  cursor: default;
  vertical-align: middle;
}

.rca-heatmap-cell:hover {
  transform: scale(1.08);
  z-index: 10;
  box-shadow: 0 2px 8px rgba(122, 183, 255, 0.3);
}

.rca-heatmap-value {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #0b1020;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
  line-height: 24px;
  white-space: nowrap;
}

.rca-heatmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px 0;
  justify-content: center;
}

.rca-heatmap-legend-item {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.rca-heatmap-legend-item span {
  display: block;
  width: 10px;
  height: 8px;
  border-radius: 2px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

/* Analytics Row (2 columns) */
.rca-analytics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* Micro Insights Grid (2x2 layout) */
.rca-micro-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

/* Compact Cards */
.rca-compact-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.rca-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.rca-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.card-header-compact {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

/* Middle Panel */
.rca-middle-panel {
  display: flex;
  flex-direction: column;
}

/* Mini Stats Grid (2x2) */
.rca-mini-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rca-mini-stat-card {
  background: var(--panel-elev);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rca-mini-stat-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rca-mini-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.rca-mini-stat-chart {
  height: 100px;
  margin-top: 8px;
}

/* Tab Navigation */
.rca-tabs {
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  position: relative;
  z-index: 10;
}

.rca-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(17, 26, 46, 0.4);
  border: 1px solid rgba(74, 85, 104, 0.3);
  border-bottom: 2px solid transparent;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  white-space: nowrap;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15),
              inset 0 1px 0 rgba(255, 255, 255, 0.03);
  z-index: 1;
}

.rca-tab i {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.rca-tab:hover {
  color: var(--ink);
  background: rgba(122, 183, 255, 0.1);
  border-color: rgba(122, 183, 255, 0.3);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2),
              0 0 0 1px rgba(122, 183, 255, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.05);
  z-index: 2;
}

.rca-tab.active {
  color: var(--accent);
  background: rgba(122, 183, 255, 0.15);
  border-color: var(--accent);
  border-bottom: 2px solid var(--accent);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(122, 183, 255, 0.25),
              0 0 0 1px rgba(122, 183, 255, 0.4),
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  z-index: 3;
  margin-top: -2px;
  padding-top: 12px;
}

.rca-tab-content {
  display: none;
}

.rca-tab-content.active {
  display: block;
}

/* Micro Insight Cards */
.rca-micro-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rca-micro-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rca-micro-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rca-micro-card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.rca-micro-card-chart {
  height: 100px;
  margin-top: 10px;
}

/* Key Findings Compact */
#rca-key-findings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 4px;
}

.rca-finding-item {
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink);
  padding-left: 16px;
  position: relative;
}

.rca-finding-item::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: 700;
}

/* Compact Collapsible Section */
.rca-collapsible-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.rca-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--panel);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  color: var(--ink);
}

.rca-section-toggle:hover {
  background: var(--panel-elev);
}

.rca-section-toggle .toggle-icon {
  transition: transform 0.3s ease;
  color: var(--accent);
  flex-shrink: 0;
}

.rca-section-toggle.active .toggle-icon {
  transform: rotate(90deg);
}

.rca-section-content {
  padding: 0 16px 16px 16px;
  background: var(--bg);
}

/* Responsive Behavior */
@media (max-width: 1024px) {
  .rca-metrics-strip {
    flex-wrap: wrap;
  }
  
  .rca-inline-metric {
    flex: 0 0 calc(33.333% - 8px);
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  
  .rca-primary-grid {
    grid-template-columns: 1fr;
  }
  
  .rca-analytics-row {
    grid-template-columns: 1fr;
  }
  
  .rca-micro-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .rca-inline-metric {
    flex: 0 0 100%;
  }
  
  .rca-mini-stats-grid {
    grid-template-columns: 1fr;
  }
  
  .rca-micro-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================= */
/* INCIDENT PAGE RESPONSIVE STYLES */
/* ============================================= */

@media (max-width: 1400px) {
  /* Stack analytics row on smaller screens */
  #page-incidents > div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 1024px) {
  /* Metrics strip wrap */
  .rca-metrics-strip {
    flex-wrap: wrap;
  }
  
  .rca-inline-metric {
    flex: 0 0 calc(50% - 8px);
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  
  .rca-inline-metric:last-child {
    border-bottom: none;
  }
  
  /* Single column for analytics on tablets */
  #page-incidents > div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  /* Compact header adjustments */
  #incidents-header h2 {
    font-size: 16px !important;
  }
  
  #incidents-header h2 > div {
    width: 32px !important;
    height: 32px !important;
  }
  
  #incidents-header h2 > div i {
    width: 18px !important;
    height: 18px !important;
  }
  
  /* Full width metrics */
  .rca-inline-metric {
    flex: 0 0 100%;
  }
  
  /* Compact filter bar */
  .filter-bar {
    flex-direction: column;
  }
  
  .filter-group {
    width: 100%;
  }
}

/* ============================================= */
/* RCA PAGE REDESIGN - Modern Compact Layout (OLD - KEEP FOR BACKWARDS COMPAT) */
/* ============================================= */

/* RCA KPI Cards - Compact Design */
.rca-kpi-card {
  background: linear-gradient(135deg, rgba(122, 183, 255, 0.08) 0%, rgba(94, 230, 168, 0.08) 100%);
  border: 1px solid rgba(122, 183, 255, 0.2);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.rca-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
}

.rca-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(122, 183, 255, 0.15);
  border-color: rgba(122, 183, 255, 0.4);
}

.rca-kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rca-kpi-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.rca-kpi-subtitle {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 8px;
}

/* Network Graph Container */
.rca-network-container .card-header {
  margin-bottom: 12px;
}

.rca-network-controls {
  display: flex;
  gap: 8px;
}

#rca-network-legend {
  margin-top: 16px;
  padding: 16px;
  background: rgba(122, 183, 255, 0.05);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

.network-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink);
}

.network-legend-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
}

/* RCA Insights Panel */
#rca-insights-summary {
  padding: 16px;
  background: linear-gradient(135deg, rgba(255, 215, 122, 0.08) 0%, rgba(122, 183, 255, 0.08) 100%);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent-2);
  margin-bottom: 16px;
}

.rca-insight-item {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 12px;
  display: flex;
  align-items: start;
  gap: 8px;
}

.rca-insight-item:last-child {
  margin-bottom: 0;
}

.rca-insight-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(122, 183, 255, 0.15);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin: 4px;
}

#rca-quick-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.rca-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--panel-elev);
  border-radius: var(--radius);
  font-size: 13px;
}

.rca-stat-label {
  color: var(--ink-muted);
  font-weight: 500;
}

.rca-stat-value {
  color: var(--accent);
  font-weight: 700;
}

/* Heatmap Controls */
.rca-heatmap-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

#rca-causal-heatmap {
  position: relative;
  overflow: hidden;
  background: rgba(11, 16, 32, 0.3);
  border-radius: var(--radius);
  padding: 24px;
}

.heatmap-cell {
  cursor: pointer;
  transition: all 0.2s ease;
}

.heatmap-cell:hover {
  stroke: var(--accent);
  stroke-width: 2;
}

.heatmap-tooltip {
  position: absolute;
  background: var(--panel-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 12px;
  line-height: 1.5;
  max-width: 250px;
}

.heatmap-tooltip.active {
  opacity: 1;
}

/* Collapsible Sections */
.rca-collapsible-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s ease;
}

.rca-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--panel);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  color: var(--ink);
}

.rca-section-toggle:hover {
  background: var(--panel-elev);
}

.rca-section-toggle .toggle-icon {
  transition: transform 0.3s ease;
  color: var(--accent);
}

.rca-section-toggle.active .toggle-icon {
  transform: rotate(90deg);
}

.rca-section-content {
  padding: 0 20px 20px 20px;
  background: var(--bg);
}

.rca-section-content .card {
  margin-bottom: 0;
  box-shadow: none;
}

/* D3 Network Graph Styles */
.network-node {
  cursor: pointer;
  transition: all 0.2s ease;
}

.network-node:hover {
  filter: brightness(1.3);
}

.network-node.selected {
  stroke: var(--accent);
  stroke-width: 3;
}

.network-link {
  stroke: rgba(122, 183, 255, 0.3);
  stroke-width: 1.5;
  transition: all 0.2s ease;
}

.network-link.risky {
  stroke: var(--bad);
  stroke-width: 2.5;
}

.network-link:hover {
  stroke: var(--accent);
  stroke-opacity: 0.8;
}

.network-label {
  font-size: 11px;
  font-weight: 600;
  fill: var(--ink);
  pointer-events: none;
  text-anchor: middle;
}

/* Chart.js Canvas Responsive */
.chart-container canvas {
  max-width: 100%;
  height: auto !important;
}

/* RCA Page Responsive */
@media (max-width: 1400px) {
  .rca-kpi-value {
    font-size: 32px;
  }
  
  .grid.grid-4#rca-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .page-section#page-rca > div[style*="grid-template-columns: 3fr 2fr"] {
    grid-template-columns: 1fr !important;
  }
  
  .page-section#page-rca > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  
  .rca-network-container .chart-container {
    height: 400px !important;
  }
}

@media (max-width: 768px) {
  .grid.grid-4#rca-kpis {
    grid-template-columns: 1fr;
  }
  
  .rca-kpi-value {
    font-size: 28px;
  }
  
  #rca-network-legend {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .rca-section-toggle {
    padding: 12px 16px;
  }
  
  .rca-section-toggle span:last-child {
    display: none;
  }
}

/* Animation for RCA Page Load */
@keyframes rcaFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-section#page-rca.active > * {
  animation: rcaFadeIn 0.5s ease-out;
}

.page-section#page-rca.active > *:nth-child(2) {
  animation-delay: 0.1s;
}

.page-section#page-rca.active > *:nth-child(3) {
  animation-delay: 0.2s;
}

.page-section#page-rca.active > *:nth-child(4) {
  animation-delay: 0.3s;
}

/* ============================================== */
/* FLEET OPS CONSOLE - COMPACT STYLES             */
/* ============================================== */

/* Fleet Compact Header */
.fleet-compact-header {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

/* Fleet Navigation Card (Hub) */
.fleet-navigation-card {
  cursor: pointer;
  padding: 16px;
  background: var(--panel-elev);
  border-radius: 8px;
  border: 1px solid var(--line);
  transition: all 0.3s ease;
}

.fleet-navigation-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(122, 183, 255, 0.2);
  background: linear-gradient(135deg, rgba(122, 183, 255, 0.05) 0%, rgba(62, 201, 214, 0.05) 100%);
}

.fleet-navigation-card:hover .fleet-navigation-card-icon {
  opacity: 1;
  transform: scale(1.1);
}

/* Fleet Insight Card */
.fleet-insight-card {
  padding: 20px;
  background: var(--panel-elev);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.fleet-insight-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Fleet Story Panel */
.fleet-story-panel {
  padding: 16px;
  background: var(--panel-elev);
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* Responsive Grid for Fleet Analytics */
@media (max-width: 1400px) {
  #fleet-navigation-hub > div > div {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  
  .card-modern > div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 1024px) {
  #fleet-navigation-hub > div > div {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  .card-modern > div[style*="grid-template-columns: repeat(3, 1fr)"],
  .card-modern > div[style*="grid-template-columns: repeat(2, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
  
  #fleet-story-section > div > div {
    grid-template-columns: 1fr !important;
  }
  
  #fleet-operations-summary > div {
    grid-template-columns: 1fr !important;
  }
  
  .rca-metrics-strip {
    flex-wrap: wrap;
  }
  
  .rca-metric-item {
    flex: 0 0 calc(50% - 8px);
  }
}

@media (max-width: 768px) {
  #fleet-navigation-hub > div > div {
    grid-template-columns: 1fr !important;
  }
  
  .fleet-navigation-card {
    padding: 12px;
  }
  
  .fleet-compact-header > div > div:first-child {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .fleet-compact-header h2 {
    font-size: 16px;
  }
  
  .fleet-compact-header > div > div:last-child {
    display: none;
  }
  
  .rca-metric-item {
    flex: 0 0 100%;
  }
  
  .fleet-insight-card {
    padding: 16px;
  }
}

/* Fleet Analytics Dashboard Grid - Responsive */
@media (max-width: 1200px) {
  .card-modern#fleet-analytics-grid > div {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .card-modern#fleet-analytics-grid > div {
    grid-template-columns: 1fr !important;
  }
}

/* Animation for Fleet Page Load */
@keyframes fleetFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-section#page-fleet.active > div {
  animation: fleetFadeIn 0.4s ease-out;
}

.page-section#page-fleet.active > div:nth-child(2) {
  animation-delay: 0.1s;
}

.page-section#page-fleet.active > div:nth-child(3) {
  animation-delay: 0.15s;
}

.page-section#page-fleet.active > div:nth-child(4) {
  animation-delay: 0.2s;
}

/* Fleet Metrics Strip Enhancement */
.rca-metrics-strip {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--panel-elev);
  border-radius: 8px;
  overflow-x: auto;
}

.rca-metric,
.rca-metric-item {
  flex: 1;
  min-width: 140px;
  padding: 12px;
  background: var(--panel);
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

.rca-metric-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.rca-metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.rca-metric-unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-muted);
  margin-left: 4px;
}

.rca-metric-change,
.rca-metric-delta {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.rca-metric-change.positive {
  color: var(--good);
}

.rca-metric-change.negative {
  color: var(--bad);
}

.rca-metric-change.neutral {
  color: var(--ink-muted);
}

.rca-metric-delta.positive {
  color: var(--good);
}

.rca-metric-delta.negative {
  color: var(--bad);
}

/* =================================================================== */
/* DATA STREAMING LINEAGE ANIMATIONS                                   */
/* =================================================================== */

/* Health indicator pulse animation */
@keyframes pulse-health {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* Particle flow animations - Fast (1.5s) - Compact version for smaller connectors */
@keyframes flow-particle-fast-compact {
  0% {
    left: 0;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    left: 45px;
    opacity: 0;
  }
}

/* Particle flow animations - Medium (2s) - Compact version */
@keyframes flow-particle-medium-compact {
  0% {
    left: 0;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    left: 45px;
    opacity: 0;
  }
}

/* Particle flow animations - Slow (2.5s) - Compact version */
@keyframes flow-particle-slow-compact {
  0% {
    left: 0;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    left: 45px;
    opacity: 0;
  }
}

/* Lineage node hover effects */
.lineage-node:hover {
  border-color: var(--accent) !important;
  box-shadow: 0 0 20px rgba(122, 183, 255, 0.4), var(--shadow) !important;
  transform: scale(1.03) !important;
}

/* Smooth scrollbar for lineage container */
.lineage-flow-container::-webkit-scrollbar {
  height: 8px;
}

.lineage-flow-container::-webkit-scrollbar-track {
  background: var(--panel);
  border-radius: 4px;
}

.lineage-flow-container::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.lineage-flow-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* SVG line animations */
.lineage-connection {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw-line 1s ease-in-out forwards;
}

@keyframes draw-line {
  to {
    stroke-dashoffset: 0;
  }
}

/* Fade in animation for lineage nodes */
.lineage-stage {
  animation: fade-in-up 0.4s ease-out;
  animation-fill-mode: both;
}

.lineage-stage:nth-child(1) { animation-delay: 0s; }
.lineage-stage:nth-child(3) { animation-delay: 0.1s; }
.lineage-stage:nth-child(5) { animation-delay: 0.2s; }
.lineage-stage:nth-child(7) { animation-delay: 0.3s; }
.lineage-stage:nth-child(9) { animation-delay: 0.4s; }
.lineage-stage:nth-child(11) { animation-delay: 0.5s; }
.lineage-stage:nth-child(13) { animation-delay: 0.6s; }

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Connector fade-in */
.lineage-connector {
  animation: fade-in 0.4s ease-out;
  animation-fill-mode: both;
}

.lineage-connector:nth-child(2) { animation-delay: 0.15s; }
.lineage-connector:nth-child(4) { animation-delay: 0.25s; }
.lineage-connector:nth-child(6) { animation-delay: 0.35s; }
.lineage-connector:nth-child(8) { animation-delay: 0.45s; }
.lineage-connector:nth-child(10) { animation-delay: 0.55s; }

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Responsive adjustments for lineage */
@media (max-width: 768px) {
  .lineage-flow-container {
    flex-direction: column;
    gap: 20px;
  }
  
  .lineage-connector {
    transform: rotate(90deg);
    width: 60px;
    height: 60px;
  }
  
  .lineage-stage {
    min-width: 100%;
  }
}

/* ============= VEHICLE EDGE ARCHITECTURE VISUALIZATION ============= */

/* Main SVG container */
.vehicle-architecture-svg {
  width: 100%;
  height: 100%;
  background: transparent;
}

/* Architecture nodes */
.architecture-node {
  transition: all 0.2s ease;
}

.architecture-node:hover {
  filter: drop-shadow(0 0 8px rgba(122, 183, 255, 0.6));
}

.architecture-node:focus {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.node-rect {
  transition: all 0.2s ease;
}

.node-label {
  pointer-events: none;
  user-select: none;
}

.node-metric {
  pointer-events: none;
  user-select: none;
  transition: all 0.3s ease;
}

.node-status {
  pointer-events: none;
}

/* Architecture links */
.architecture-link {
  transition: all 0.2s ease;
}

.architecture-link:hover {
  stroke-opacity: 0.8 !important;
}

/* Layer labels */
.layer-label {
  pointer-events: none;
  user-select: none;
}

/* Tooltip */
.architecture-tooltip {
  font-family: var(--font);
  animation: tooltip-fade-in 0.2s ease;
}

@keyframes tooltip-fade-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Detail Modal */
.architecture-detail-modal {
  animation: modal-fade-in 0.3s ease;
}

@keyframes modal-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Flow particle animations */
@keyframes flow-particle {
  0% {
    offset-distance: 0%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    offset-distance: 100%;
    opacity: 0;
  }
}

.flow-particle {
  animation: flow-particle 2s linear infinite;
}

.flow-particle-fast {
  animation: flow-particle 1.5s linear infinite;
}

.flow-particle-slow {
  animation: flow-particle 3s linear infinite;
}

/* Pulsing health indicator */
@keyframes pulse-health {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* Glow effect on hover */
@keyframes node-glow {
  0%, 100% {
    filter: drop-shadow(0 0 4px currentColor);
  }
  50% {
    filter: drop-shadow(0 0 12px currentColor);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .architecture-node,
  .architecture-link,
  .node-rect,
  .node-metric,
  .flow-particle,
  .flow-particle-fast,
  .flow-particle-slow {
    transition: none !important;
    animation: none !important;
  }
  
  .architecture-detail-modal,
  .architecture-tooltip {
    animation: none !important;
  }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .vehicle-architecture-svg {
    height: 700px;
  }
  
  .node-label {
    font-size: 10px;
  }
  
  .node-metric {
    font-size: 8px;
  }
}

@media (max-width: 768px) {
  .vehicle-architecture-svg {
    height: 600px;
  }
  
  .node-rect {
    x: -50;
    y: -35;
    width: 100;
    height: 70;
  }
  
  .node-label {
    font-size: 9px;
  }
  
  .node-metric {
    font-size: 7px;
  }
  
  .layer-label {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .vehicle-architecture-svg {
    height: 500px;
  }
  
  .architecture-detail-modal > div {
    width: 95% !important;
    max-height: 90vh !important;
  }
}

/* ========================================
   SENSOR STUDIO REDESIGN STYLES
   ======================================== */

/* Metrics Dashboard Strip */
.studio-metrics-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.studio-metric-card {
  background: var(--panel-elev);
  border-radius: var(--radius);
  padding: 16px;
  border-left: 3px solid var(--accent);
  transition: all 0.3s ease;
}

.studio-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.studio-metric-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.studio-metric-label {
  font-size: 11px;
  color: var(--ink-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.studio-metric-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.studio-metric-chart {
  height: 40px;
  margin-top: 8px;
}

/* Main Tab Navigation */
.studio-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 0;
}

.studio-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: -2px;
}

.studio-tab:hover {
  color: var(--ink);
  background: rgba(122, 183, 255, 0.05);
}

.studio-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(122, 183, 255, 0.08);
}

.studio-tab.ml-tab {
  background: linear-gradient(135deg, rgba(147, 112, 219, 0.1) 0%, rgba(122, 183, 255, 0.1) 100%);
  position: relative;
}

.studio-tab.ml-tab.active {
  border-bottom-color: #9370db;
  color: #9370db;
  background: linear-gradient(135deg, rgba(147, 112, 219, 0.15) 0%, rgba(122, 183, 255, 0.15) 100%);
}

.studio-tab.ml-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #9370db, var(--accent-2));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.studio-tab.ml-tab.active::before {
  opacity: 1;
}

/* Sub-Tab Navigation */
.studio-sub-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px;
  background: var(--panel-elev);
  border-radius: var(--radius);
}

.studio-sub-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.studio-sub-tab:hover {
  color: var(--ink);
  background: rgba(122, 183, 255, 0.05);
  border-color: rgba(122, 183, 255, 0.2);
}

.studio-sub-tab.active {
  color: var(--accent);
  background: rgba(122, 183, 255, 0.1);
  border-color: var(--accent);
}

/* Tab Content */
.studio-tab-content-wrapper {
  display: none;
}

.studio-tab-content-wrapper.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stat Cards (Mini) */
.studio-stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card-mini {
  background: var(--panel-elev);
  border-radius: var(--radius);
  padding: 16px;
  border-left: 3px solid var(--accent);
}

.stat-card-mini-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.stat-card-mini-label {
  font-size: 11px;
  color: var(--ink-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.stat-card-mini-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.stat-card-mini-subtitle {
  font-size: 11px;
  color: var(--ink-muted);
}

.stat-card-mini-chart {
  height: 50px;
  margin-top: 8px;
}

/* ML Studio Special Styling */
.ml-studio-header {
  background: linear-gradient(135deg, rgba(147, 112, 219, 0.15) 0%, rgba(122, 183, 255, 0.15) 100%);
  border: 2px solid rgba(147, 112, 219, 0.3);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.ml-studio-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #9370db, var(--accent-2), var(--accent));
}

.ml-studio-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.ml-studio-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #9370db, var(--accent-2));
  border-radius: 16px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ml-studio-description {
  font-size: 14px;
  color: var(--ink-muted);
  line-height: 1.6;
}

.ml-studio-content .stat-card-mini {
  border-left-color: #9370db;
}

.ml-studio-content .card {
  border-left: 3px solid #9370db;
}

/* Expandable Sections */
.expandable-section {
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
}

.expandable-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--panel-elev);
}

.expandable-section-header:hover {
  background: rgba(122, 183, 255, 0.05);
}

.expandable-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.expandable-section-chevron {
  transition: transform 0.3s ease;
  color: var(--accent);
}

.expandable-section.expanded .expandable-section-chevron {
  transform: rotate(90deg);
}

.expandable-section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
  padding: 0 20px;
}

.expandable-section.expanded .expandable-section-content {
  max-height: 2000px;
  padding: 20px;
  border-top: 1px solid var(--line);
}

/* Chart Containers */
.studio-chart-container {
  background: var(--panel-elev);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.studio-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.studio-chart-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.studio-chart-wrapper {
  position: relative;
  height: 250px;
}

/* Info Panels */
.studio-info-panel {
  padding: 16px;
  background: rgba(33, 150, 243, 0.1);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  margin-top: 16px;
}

.studio-info-panel.ml-panel {
  background: rgba(147, 112, 219, 0.1);
  border-left-color: #9370db;
}

.studio-info-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.studio-info-panel.ml-panel .studio-info-panel-title {
  color: #9370db;
}

.studio-info-panel-text {
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.6;
}

/* Data Table */
.data-table {
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  background: var(--panel-elev);
  font-weight: 600;
  font-size: 12px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
  background: var(--panel-elev);
  transition: background 0.2s;
}

/* Retro Stats Panel (80s Terminal Style) */
.retro-stats-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 280px;
  background: #0a0e14;
  border: 2px solid #1a2332;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 
              inset 0 0 20px rgba(0, 255, 100, 0.02);
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  z-index: 100;
  transition: all 0.3s ease;
}

.retro-stats-panel.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.retro-stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(135deg, #1a2332 0%, #0f1419 100%);
  border-bottom: 1px solid #2a3342;
  border-radius: 4px 4px 0 0;
}

.retro-stats-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #5ee6a8;
  text-shadow: 0 0 8px rgba(94, 230, 168, 0.4);
}

.retro-close-btn {
  background: none;
  border: none;
  color: #ff5733;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.retro-close-btn:hover {
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 87, 51, 0.6);
  transform: scale(1.1);
}

.retro-stats-content {
  padding: 8px;
  max-height: 500px;
  overflow-y: auto;
}

.retro-stats-content::-webkit-scrollbar {
  width: 6px;
}

.retro-stats-content::-webkit-scrollbar-track {
  background: #0a0e14;
}

.retro-stats-content::-webkit-scrollbar-thumb {
  background: #2a3342;
  border-radius: 3px;
}

.retro-stats-content::-webkit-scrollbar-thumb:hover {
  background: #3a4352;
}

.retro-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  margin-bottom: 2px;
  background: rgba(26, 35, 50, 0.3);
  border-left: 2px solid transparent;
  transition: all 0.2s;
  font-size: 11px;
  line-height: 1.4;
}

.retro-stat-row:hover {
  background: rgba(26, 35, 50, 0.6);
  border-left-color: #5ee6a8;
}

.retro-stat-key {
  color: #a0a8b8;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-size: 10px;
}

.retro-stat-value {
  font-weight: 700;
  font-size: 12px;
  text-shadow: 0 0 6px currentColor;
  font-family: 'SF Mono', monospace;
}

/* Retro Show Stats Button - Sleek & Modern */
.retro-show-stats-btn {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(94, 230, 168, 0.2);
  border-radius: 6px;
  color: #5ee6a8;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.retro-show-stats-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(94, 230, 168, 0.4);
  transform: translateY(-1px);
}

.retro-show-stats-btn i,
.retro-show-stats-btn svg {
  filter: drop-shadow(0 0 8px rgba(94, 230, 168, 0.6));
  animation: icon-glow 2s ease-in-out infinite;
}

.retro-show-stats-btn {
  text-shadow: 0 0 10px rgba(94, 230, 168, 0.6);
  animation: text-glow 2s ease-in-out infinite;
}

@keyframes icon-glow {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(94, 230, 168, 0.6));
  }
  50% {
    filter: drop-shadow(0 0 15px rgba(94, 230, 168, 0.9));
  }
}

@keyframes text-glow {
  0%, 100% {
    text-shadow: 0 0 10px rgba(94, 230, 168, 0.6);
  }
  50% {
    text-shadow: 0 0 18px rgba(94, 230, 168, 0.9);
  }
}

/* Responsive */
@media (max-width: 1200px) {
  .studio-metrics-strip {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .studio-stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .studio-metrics-strip,
  .studio-stat-cards {
    grid-template-columns: 1fr;
  }
  
  .studio-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  
  .studio-sub-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}


/* ============================================
   System Architecture Diagram Styles
   ============================================ */

/* Container */
#system-architecture-container {
  width: 100%;
  min-height: auto;
  background: transparent;
  border-radius: 12px;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Zoom Controls */
.zoom-controls {
  background: rgba(11, 16, 32, 0.9);
  border: 1px solid rgba(122, 183, 255, 0.3);
  border-radius: 8px;
  padding: 8px;
  backdrop-filter: blur(10px);
}

.zoom-btn {
  width: 32px;
  height: 32px;
  background: rgba(122, 183, 255, 0.1);
  border: 1px solid rgba(122, 183, 255, 0.3);
  border-radius: 6px;
  color: #7ab7ff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.zoom-btn:hover {
  background: rgba(122, 183, 255, 0.2);
  border-color: rgba(122, 183, 255, 0.5);
  transform: scale(1.05);
}

.zoom-btn:active {
  transform: scale(0.95);
}

.zoom-btn i {
  width: 16px;
  height: 16px;
}

/* Hide zoom controls on mobile */
@media (max-width: 768px) {
  .zoom-controls {
    display: none;
  }
}

/* SVG Canvas */
.system-architecture-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Node Interactions */
.system-arch-node {
  cursor: pointer;
  transition: all 0.2s ease;
}

.system-arch-node:hover .node-shape {
  filter: brightness(1.2);
}

.system-arch-node:focus {
  outline: 2px solid #4FD1C5;
  outline-offset: 4px;
}

/* Links */
.system-arch-link {
  transition: stroke-opacity 0.2s ease, stroke-width 0.2s ease;
}

/* Particles */
.flow-particle {
  pointer-events: none;
}

/* Tooltip */
.system-arch-tooltip {
  position: absolute;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 10000;
  max-width: 260px;
  font-size: 11px;
  color: #ffffff;
}

/* Modal */
.system-arch-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.system-arch-modal > div {
  background: #1a1f2e;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.system-arch-modal > div::-webkit-scrollbar {
  width: 8px;
}

.system-arch-modal > div::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.system-arch-modal > div::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.system-arch-modal > div::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   US GEO MAP ANIMATIONS
   ============================================ */

/* Critical state markers - pulsing animation */
@keyframes pulse-critical {
  0%, 100% { 
    transform: scale(1); 
    opacity: 0.9; 
  }
  50% { 
    transform: scale(1.25); 
    opacity: 0.5; 
  }
}

/* Medium severity markers - glow pulse */
@keyframes glow-medium {
  0%, 100% { 
    opacity: 0.85;
  }
  50% { 
    opacity: 1;
  }
}

/* Low severity markers - subtle glow */
@keyframes subtle-glow {
  0%, 100% { 
    opacity: 0.8;
  }
  50% { 
    opacity: 0.95;
  }
}

/* Ripple effect - expanding rings */
@keyframes ripple-expand {
  0% {
    transform: scale(0.8);
    opacity: 0.8;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* Marker classes for different severity levels */
.geo-marker-critical {
  animation: pulse-critical 2s ease-in-out infinite;
  transform-origin: center center;
  transform-box: fill-box;
}

.geo-marker-medium {
  animation: glow-medium 3s ease-in-out infinite;
}

.geo-marker-low {
  animation: subtle-glow 4s ease-in-out infinite;
}

/* Ripple ring animation */
.geo-marker-ripple {
  animation: ripple-expand 2.5s ease-out infinite;
  transform-origin: center center;
  transform-box: fill-box;
}

/* Halo layers for neon effect */
.geo-marker-halo {
  opacity: 0.2;
  pointer-events: none;
}

/* Enhanced tooltip for geo map */
.geo-tooltip {
  position: absolute;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(0,0,0,0.95), rgba(20,20,40,0.95));
  border: 2px solid;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.geo-tooltip.active {
  opacity: 1;
}

.geo-tooltip strong {
  font-size: 15px;
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.geo-tooltip-critical {
  border-color: #FF0080;
  box-shadow: 0 0 20px rgba(255, 0, 128, 0.4), 0 8px 24px rgba(0,0,0,0.6);
}

.geo-tooltip-medium {
  border-color: #FFD700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4), 0 8px 24px rgba(0,0,0,0.6);
}

.geo-tooltip-low {
  border-color: #00FF88;
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.4), 0 8px 24px rgba(0,0,0,0.6);
}

/* State label expansion animation */
.geo-state-label {
  transition: all 0.15s ease-out;
}

.geo-state-label.expanded {
  font-size: 13px;
  font-weight: 700;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .geo-marker-critical,
  .geo-marker-medium,
  .geo-marker-low,
  .geo-marker-ripple {
    animation: none !important;
  }
  
  .geo-state-label {
    transition: none;
  }
  
  .geo-marker-group * {
    animation: none !important;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  #system-architecture-container {
    min-height: auto;
    overflow: visible;
  }
  
  .system-architecture-svg {
    touch-action: pan-x pan-y pinch-zoom;
    cursor: grab;
  }
  
  .system-architecture-svg:active {
    cursor: grabbing;
  }
  
  .system-arch-tooltip {
    font-size: 10px;
    max-width: 220px;
    padding: 10px;
  }
  
  .system-arch-modal > div {
    width: 95%;
    max-height: 90vh;
  }
}
