:root {
  --bg-main: #f0f4f8;
  --bg-card: rgba(255, 255, 255, 0.45);
  --border-color: rgba(255, 255, 255, 0.6);
  --border-focus: rgba(99, 102, 241, 0.4);
  
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --primary-glow: rgba(79, 70, 229, 0.15);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.1);
  
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.1);
  
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.1);
  
  --text-main: #1f2937;
  --text-muted: #6b7280;
  
  --font-display: 'Outfit', 'Inter', sans-serif;
  --font-code: 'SF Mono', Menlo, Monaco, Consolas, monospace;
  
  /* Smooth iOS spring-like transition curve */
  --ios-transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  --ios-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  position: relative;
  padding-bottom: 40px;
  /* Soft, flowing background pattern */
  background-image: 
    radial-gradient(at 0% 0%, rgba(224, 231, 255, 0.6) 0, transparent 50%),
    radial-gradient(at 50% 0%, rgba(243, 232, 255, 0.6) 0, transparent 50%),
    radial-gradient(at 100% 0%, rgba(204, 251, 241, 0.6) 0, transparent 50%);
}

.video-element-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* iOS Blurry Liquid Glass Background Orbs */
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -2;
  opacity: 0.5;
  animation: float 20s infinite alternate ease-in-out;
}
.orb-1 {
  width: 500px;
  height: 500px;
  background: linear-gradient(135deg, #a5b4fc, #c7d2fe);
  top: -150px;
  right: -50px;
}
.orb-2 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, #fcd34d, #fde68a);
  bottom: 5%;
  left: -100px;
  animation-delay: -5s;
}

@keyframes float {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(50px) scale(1.1); }
}

/* App Header styling */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.02);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #1e293b 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.5);
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 600;
  color: #1f2937;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 10px var(--success); }
  100% { transform: scale(0.95); opacity: 0.5; }
}

/* App Container */
.app-container {
  max-width: 1300px;
  margin: 40px auto;
  padding: 0 24px;
}

/* Screen Transitions */
.app-screen {
  display: none;
  animation: iosSlideIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-screen.active {
  display: block;
}

@keyframes iosSlideIn {
  from { opacity: 0; transform: translateY(30px) scale(0.98); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* Liquid Glass Cards */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 
    0 10px 40px rgba(31, 38, 135, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: var(--ios-transition);
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 15px 50px rgba(31, 38, 135, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.8);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--ios-transition);
  border: none;
  outline: none;
}

.btn:active {
  transform: scale(0.96) !important;
}

.btn-primary {
  background: #1e1b4b; /* Dark indigo for extremely premium feel */
  color: white;
  box-shadow: 0 8px 25px rgba(30, 27, 75, 0.15);
}

.btn-primary:hover {
  background: #312e81;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(30, 27, 75, 0.25);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: var(--text-main);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 5px 12px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.red-pulse {
  animation: redPulse 2s infinite;
}

@keyframes redPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); opacity: 0.9; }
  100% { transform: scale(1); }
}

/* Hero Section */
.hero-section {
  text-align: center;
  margin-bottom: 40px;
}

.hero-section h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #111827 30%, #374151 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Centered Upload Container */
.upload-center-container {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  width: 100%;
}

.upload-card {
  max-width: 550px;
  width: 100%;
}

.error-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(239, 68, 68, 0.08);
  border: 1.5px solid rgba(239, 68, 68, 0.25);
  border-radius: 14px;
  margin-top: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  animation: shakeWarning 0.5s ease-in-out;
}

.error-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  padding-bottom: 12px;
  color: #111827;
  letter-spacing: -0.3px;
}

.maintenance-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 25px;
}

.maint-option {
  display: flex;
  align-items: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  cursor: pointer;
  transition: var(--ios-transition);
}

.maint-option input[type="radio"] {
  display: none;
}

.maint-option.active {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--primary-light);
  box-shadow: 
    0 10px 30px rgba(99, 102, 241, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: scale(1.01);
}

.option-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.option-km {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.option-name {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}

.option-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.train-meta-form {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 15px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.7);
  padding: 14px;
  border-radius: 12px;
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  outline: none;
  transition: var(--ios-transition);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.input-group input:focus {
  border-color: var(--primary-light);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.1);
}

/* Upload Dropzone */
.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 50px 30px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  text-align: center;
  transition: var(--ios-transition);
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--primary-light);
  background: rgba(255, 255, 255, 0.5);
}

.upload-icon {
  width: 44px;
  height: 44px;
  color: var(--text-muted);
  margin-bottom: 15px;
  transition: var(--ios-transition);
}

.upload-dropzone:hover .upload-icon {
  color: var(--primary);
  transform: translateY(-4px);
}

.upload-text-main {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}

.upload-text-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 15px;
}

.divider-text {
  font-size: 10px;
  color: var(--text-muted);
  margin: 10px 0;
  display: flex;
  align-items: center;
  width: 100%;
}
.divider-text::before, .divider-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 0 10px;
}

.file-hidden {
  display: none;
}

/* File Info Box */
.selected-file-info {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 16px;
  margin-top: 20px;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.04);
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.file-details {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-details svg {
  color: var(--primary);
}

.file-meta {
  display: flex;
  flex-direction: column;
}

.file-name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  word-break: break-all;
}

.file-size {
  font-size: 11px;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* SCREEN 2: Processing Layout */
.processing-layout {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 30px;
  min-height: 520px;
}

.stream-panel {
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.panel-header h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.stream-cam-name {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

.video-container {
  position: relative;
  background: #0b0f19;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 16/9;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

#analysis-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-overlay-banner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 10px 16px;
  font-family: var(--font-code);
  font-size: 10px;
  color: #374151;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-running-text::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse 1.5s infinite;
}

.progress-bar-container {
  margin-top: 20px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 8px;
  font-weight: 600;
}

.progress-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 99px;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.2);
  transition: width 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Console Panel styling */
.console-panel {
  display: flex;
  flex-direction: column;
}

.log-speed {
  font-size: 11px;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.console-output {
  flex: 1;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 16px;
  padding: 20px;
  font-family: var(--font-code);
  font-size: 11px;
  color: #374151; /* Dark professional text */
  overflow-y: auto;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03);
}

.log-line {
  line-height: 1.5;
  white-space: pre-wrap;
  border-bottom: 1px solid rgba(0, 0, 0, 0.02);
  padding-bottom: 4px;
}

.log-line.system {
  color: var(--primary);
  font-weight: 600;
}

.log-line.defect-bad {
  color: var(--danger);
  font-weight: 700;
}

.log-line.defect-unusual {
  color: var(--warning);
  font-weight: 700;
}

/* SCREEN 3: Report overview cards */
.report-overview-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.overview-metric-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.metric-icon.good {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.metric-icon.bad {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.metric-icon.unusual {
  background: rgba(245, 158, 11, 0.08);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.metric-data {
  display: flex;
  flex-direction: column;
}

.metric-val {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: #111827;
}

.metric-lbl {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

.overview-info-card {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  color: #1f2937;
}

.info-row strong {
  color: var(--text-muted);
}

/* Report Grid layout */
.report-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.panel-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Interactive train schematic map */
.train-schematic-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 480px;
  padding: 16px;
  margin: 15px 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.train-schematic {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 10px 5px;
  min-width: unset;
  justify-items: center;
  align-items: center;
}

/* Engine block visualization */
.engine-block {
  width: 110px;
  height: 60px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border: 1.5px solid #94a3b8;
  border-radius: 8px 24px 8px 8px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: #475569;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

/* Coach/Bogie Block */
.bogie-block {
  width: 130px;
  height: 55px;
  background: rgba(255, 255, 255, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: var(--ios-bounce);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.bogie-block:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
}

.bogie-block.selected {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.08);
}

.bogie-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: #1f2937;
}

.bogie-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Bogie state outlines */
.bogie-block.state-good {
  border-color: var(--success);
}
.bogie-block.state-good .bogie-status-dot {
  background: var(--success);
}

.bogie-block.state-bad {
  border-color: var(--danger);
  animation: shakeWarning 6s infinite;
}
.bogie-block.state-bad .bogie-status-dot {
  background: var(--danger);
}

.bogie-block.state-unusual {
  border-color: var(--warning);
}
.bogie-block.state-unusual .bogie-status-dot {
  background: var(--warning);
}

@keyframes shakeWarning {
  0%, 90%, 100% { transform: translate(0, 0); }
  92%, 96% { transform: translate(-2px, 0); }
  94%, 98% { transform: translate(2px, 0); }
}

/* Wheels representation under bogies */
.bogie-wheels-row {
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  padding: 0 16px;
}

.schematic-wheel {
  width: 14px;
  height: 14px;
  background: #cbd5e1;
  border: 2px solid #94a3b8;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transition: var(--ios-transition);
}

.bogie-block.state-good .schematic-wheel {
  border-color: var(--success);
}
.bogie-block.state-bad .schematic-wheel.is-defective {
  background: var(--danger);
  border-color: #fff;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}
.bogie-block.state-unusual .schematic-wheel.is-defective {
  background: var(--warning);
  border-color: #fff;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

/* Coupler line between bogies */
.bogie-coupler {
  width: 24px;
  height: 3px;
  background: #cbd5e1;
  flex-shrink: 0;
}

/* Legend styling */
.legend-container {
  display: flex;
  gap: 20px;
  margin-top: 15px;
  justify-content: flex-start;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.good { background: var(--success); }
.legend-dot.bad { background: var(--danger); }
.legend-dot.unusual { background: var(--warning); }

/* Right detail panel */
.detail-inspection-panel {
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  color: var(--text-muted);
  gap: 15px;
  font-size: 13px;
  max-width: 280px;
  margin: 0 auto;
}

.empty-state svg {
  opacity: 0.5;
  color: var(--primary-light);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.detail-header h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: #111827;
}

/* Wheels inspection list */
.wheel-inspect-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.wheel-card {
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: var(--ios-transition);
}

.wheel-card:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-1px);
}

.wheel-card.active {
  border-color: var(--primary-light);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.05);
}

.wheel-card.state-good { border-left: 3px solid var(--success); }
.wheel-card.state-bad { border-left: 3px solid var(--danger); }
.wheel-card.state-unusual { border-left: 3px solid var(--warning); }

.wheel-card-num {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.wheel-card-status {
  font-size: 10px;
  font-weight: 700;
  margin-top: 4px;
}
.wheel-card.state-good .wheel-card-status { color: var(--success); }
.wheel-card.state-bad .wheel-card-status { color: var(--danger); }
.wheel-card.state-unusual .wheel-card-status { color: var(--warning); }

/* Defect Evidence Media container */
.defect-insight-box {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.01);
  animation: fadeIn 0.4s ease;
}

.defect-insight-box h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.defect-media-container {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  align-items: center;
}

.defect-media-container img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  aspect-ratio: 1.1;
  object-fit: cover;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.defect-annotations {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.annotation-badge {
  align-self: flex-start;
  padding: 4px 10px;
  font-size: 9px;
  font-weight: 700;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.annotation-badge.bad {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}
.annotation-badge.unusual {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}
.annotation-badge.good {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.annotation-text {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.5;
}

/* Action Row at Bottom of Report */
.action-row {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  margin-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  padding-top: 20px;
}

/* EMAIL MODAL WINDOW STYLING */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-container {
  max-width: 650px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.08);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  padding-bottom: 15px;
  margin-bottom: 15px;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #000;
}

.modal-body {
  overflow-y: auto;
  padding-right: 5px;
  flex: 1;
}

.modal-intro {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 15px;
}

.email-mock-box {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 14px;
  overflow: hidden;
}

.email-meta {
  background: rgba(0, 0, 0, 0.02);
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-muted);
}

.email-meta strong {
  color: var(--text-main);
}

.email-content {
  padding: 20px;
  font-family: var(--font-code);
  font-size: 11px;
  line-height: 1.6;
  color: #374151;
  white-space: pre-wrap;
  max-height: 250px;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  padding-top: 15px;
}

/* Printable Print Layout overriding styles */
#print-report-container {
  display: none;
}

@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12px;
  }
  .app-header, .glow-orb, .action-row, .legend-container, .train-layout-panel, .panel-subtitle, #btn-demo-video, .card-title, #screen-upload, #screen-processing, #screen-report {
    display: none !important;
  }
  #print-report-container {
    display: block !important;
  }
}

/* Bounce animation for iOS warning popup */
.bounce-modal {
  animation: iosBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes iosBounce {
  0% { transform: scale(0.85); opacity: 0; }
  70% { transform: scale(1.04); opacity: 0.9; }
  100% { transform: scale(1); opacity: 1; }
}

.error-modal-icon-glow {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.08);
  border: 2.2px solid var(--danger);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
  animation: pulseWarning 2s infinite;
}

@keyframes pulseWarning {
  0% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.15); }
  50% { box-shadow: 0 0 25px rgba(239, 68, 68, 0.35); }
  100% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.15); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

