/* Global Reset & Colors */
:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #0d1527;
  --card-bg: rgba(18, 28, 52, 0.4);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-glow: rgba(0, 242, 254, 0.15);
  
  --color-text: #ffffff;
  --color-muted: #8e9bb2;
  --color-primary: #00f2fe;
  --color-primary-glow: rgba(0, 242, 254, 0.6);
  --color-secondary: #ffe600;
  --color-secondary-glow: rgba(255, 230, 0, 0.5);
  --color-success: #00e676;
  --color-error: #ff1744;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-digital: 'Orbitron', monospace;
  
  --shadow-glow: 0 8px 32px 0 rgba(0, 242, 254, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(13, 29, 65, 0.5) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(10, 48, 86, 0.3) 0px, transparent 50%);
  color: var(--color-text);
  min-height: 100vh;
  padding: 10px;
  overflow-x: hidden;
  line-height: 1.5;
}

/* App Layout Container */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: rgba(13, 21, 39, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 6px var(--color-primary-glow));
}

.app-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.app-header h1 span {
  color: var(--color-primary);
  text-shadow: 0 0 10px var(--color-primary-glow);
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid currentColor;
  text-transform: uppercase;
}

.status-badge.offline {
  color: var(--color-success);
  background: rgba(0, 230, 118, 0.15);
}

.status-badge.online {
  color: var(--color-primary);
  background: rgba(0, 242, 254, 0.15);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
  .primary-display-card {
    grid-column: span 2;
  }
}

/* Cards (Glassmorphism) */
.card {
  position: relative;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-glow);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: rgba(0, 242, 254, 0.25);
  box-shadow: 0 8px 32px 0 rgba(0, 242, 254, 0.12);
}

.card-bg-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.05) 0%, transparent 60%);
  pointer-events: none;
}

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

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.3px;
}

/* Primary Hz Readout Card */
.primary-display-card {
  text-align: center;
  padding: 25px 20px;
  border-color: rgba(0, 242, 254, 0.2);
}

.primary-display-card .label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-muted);
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.primary-display-card .readout {
  font-family: var(--font-digital);
  font-size: 4.5rem;
  font-weight: 900;
  color: var(--color-primary);
  text-shadow: 0 0 20px rgba(0, 242, 254, 0.5);
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  line-height: 1;
}

.primary-display-card .unit {
  font-size: 1.8rem;
  font-weight: 700;
  margin-left: 5px;
  color: var(--color-muted);
  text-shadow: none;
}

.analysis-status {
  margin-top: 5px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-secondary);
  text-shadow: 0 0 6px var(--color-secondary-glow);
}

/* Driver & Flicker Metrics Grid */
.driver-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 18px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 480px) {
  .driver-metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .driver-metrics-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.sub-metric-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.sub-metric-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.sub-metric-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-muted);
  letter-spacing: 1px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.sub-metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  transition: all 0.3s ease;
}

#flicker-pct-val {
  font-family: var(--font-digital);
  font-size: 1.15rem;
  color: var(--color-primary);
  text-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

/* Rating Text Colors & Glows */
.rating-none {
  color: var(--color-muted);
}

.rating-excellent {
  color: var(--color-success);
  text-shadow: 0 0 8px rgba(0, 230, 118, 0.4);
}

.rating-sunlight {
  color: #ffb300;
  text-shadow: 0 0 10px rgba(255, 179, 0, 0.5);
}

.rating-high-quality {
  color: var(--color-primary);
  text-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

.rating-low-quality {
  color: var(--color-secondary);
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.4);
}

.rating-hazard {
  color: var(--color-error);
  text-shadow: 0 0 10px rgba(255, 23, 68, 0.5);
}

@media (max-width: 480px) {
  .driver-metrics-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* Confidence Bar */
.confidence-container {
  margin-top: 20px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.confidence-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 6px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00f2fe, #4facfe);
  border-radius: 10px;
  box-shadow: 0 0 8px var(--color-primary-glow);
  transition: width 0.2s ease;
}

/* Grid Match Tag */
.grid-match-container {
  margin-top: 15px;
}

.match-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 30px;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.match-tag.none {
  background: rgba(255, 255, 255, 0.03);
  color: var(--color-muted);
  border-color: rgba(255, 255, 255, 0.05);
}

.match-tag.grid50 {
  background: rgba(255, 230, 0, 0.15);
  color: var(--color-secondary);
  border-color: var(--color-secondary);
  box-shadow: 0 0 10px rgba(255, 230, 0, 0.2);
}

.match-tag.grid60 {
  background: rgba(0, 242, 254, 0.15);
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.match-tag.pwm {
  background: rgba(255, 23, 68, 0.1);
  color: #ff1744;
  border-color: rgba(255, 23, 68, 0.3);
}

.match-tag.sunlight {
  background: rgba(255, 179, 0, 0.16);
  color: #ffb300;
  border-color: #ffb300;
  box-shadow: 0 0 12px rgba(255, 179, 0, 0.35);
}

/* Real-Time Health & Diagnostic Feedback Card */
.health-feedback-card {
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
  transition: all 0.3s ease;
}

.health-feedback-card.feedback-sunlight {
  border-color: rgba(255, 179, 0, 0.5);
  background: rgba(255, 179, 0, 0.05);
}

.badge-tag-sm.badge-sunlight {
  background: rgba(255, 179, 0, 0.2);
  color: #ffb300;
  border: 1px solid #ffb300;
}

.health-feedback-card.feedback-safe {
  border-color: rgba(0, 230, 118, 0.4);
  background: rgba(0, 230, 118, 0.04);
}

.health-feedback-card.feedback-incandescent {
  border-color: rgba(0, 242, 254, 0.4);
  background: rgba(0, 242, 254, 0.04);
}

.health-feedback-card.feedback-caution {
  border-color: rgba(255, 230, 0, 0.4);
  background: rgba(255, 230, 0, 0.04);
}

.health-feedback-card.feedback-hazard {
  border-color: rgba(255, 23, 68, 0.5);
  background: rgba(255, 23, 68, 0.06);
}

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

.feedback-headline {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.3px;
}

.feedback-desc {
  font-size: 0.8rem;
  color: var(--color-muted);
  line-height: 1.4;
  margin: 0 0 10px 0;
}

.feedback-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
}

@media (max-width: 600px) {
  .feedback-details-grid {
    grid-template-columns: 1fr;
  }
}

.feedback-detail-box .detail-label {
  display: block;
  font-weight: 600;
  color: var(--color-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.feedback-detail-box .detail-val {
  color: var(--color-text);
  font-weight: 500;
}

/* Camera Preview Card */
.preview-card {
  display: flex;
  flex-direction: column;
}

.scanner-axis {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--color-primary);
  border: 1px solid rgba(0, 242, 254, 0.2);
}

.preview-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1; /* Make preview square */
  background: #050811;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

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

/* Scan Line Laser Animation */
.scan-laser-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  box-shadow: 0 0 8px 1px var(--color-primary);
  pointer-events: none;
  display: none;
}

.scan-laser-line.vertical-scan {
  display: block;
  animation: laserMoveY 3s linear infinite;
}

.scan-laser-line.horizontal-scan {
  display: block;
  top: 0;
  height: 100%;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--color-primary), transparent);
  box-shadow: 0 0 8px 1px var(--color-primary);
  animation: laserMoveX 3s linear infinite;
}

@keyframes laserMoveY {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

@keyframes laserMoveX {
  0% { left: 0%; }
  50% { left: 100%; }
  100% { left: 0%; }
}

/* Crosshair overlay */
.target-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.target-crosshair::before,
.target-crosshair::after {
  content: '';
  position: absolute;
  background: rgba(0, 242, 254, 0.4);
}

/* Crosshair cross lines */
.target-crosshair::before {
  top: 19px;
  left: 0;
  width: 40px;
  height: 2px;
}

.target-crosshair::after {
  top: 0;
  left: 19px;
  width: 2px;
  height: 40px;
}

/* Center dot */
.target-crosshair::parent {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary);
}

.overlay-message {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 15, 29, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 20px;
  text-align: center;
  z-index: 10;
  color: var(--color-muted);
}

.overlay-message p {
  color: var(--color-text);
  font-weight: 500;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 242, 254, 0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.preview-footer {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--color-muted);
  text-align: center;
}

/* Diagnostics & Charts Card */
.charts-card {
  display: flex;
  flex-direction: column;
}

.tabs {
  display: flex;
  gap: 5px;
  background: rgba(255, 255, 255, 0.03);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-muted);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--color-primary);
  color: #0a0f1d;
  box-shadow: 0 2px 8px var(--color-primary-glow);
}

.chart-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1.6;
  background: #050811;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chart-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
}

.chart-wrapper.active {
  opacity: 1;
  pointer-events: auto;
}

.chart-wrapper canvas {
  width: 100%;
  flex-grow: 1;
  display: block;
}

.chart-overlay-label {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-muted);
  letter-spacing: 0.5px;
  pointer-events: none;
  background: rgba(5, 8, 17, 0.8);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Controls Card & Settings */
.controls-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

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

.control-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-muted);
  letter-spacing: 0.5px;
}

.styled-select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  color: var(--color-text);
  padding: 10px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  width: 100%;
  transition: border-color 0.2s ease;
}

.styled-select:focus {
  border-color: var(--color-primary);
}

.slider-group {
  margin-top: 5px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#skew-val {
  font-family: var(--font-digital);
  color: var(--color-primary);
  font-size: 1rem;
  text-shadow: 0 0 6px var(--color-primary-glow);
}

.styled-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  outline: none;
  margin: 10px 0;
}

.styled-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary-glow);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.styled-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.styled-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary-glow);
  cursor: pointer;
  border: none;
  transition: transform 0.1s ease;
}

.styled-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--color-muted);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 5px;
}

/* Button UI */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  user-select: none;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--color-primary);
  color: #0a0f1d;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.btn-primary:hover {
  background: #00d7e2;
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--card-border);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.btn-primary:active,
.btn-secondary:active {
  transform: translateY(1px);
}

.btn-block {
  width: 100%;
}

.btn.frozen {
  background: var(--color-error);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(255, 23, 68, 0.3);
}

/* Info Section Card */
.info-card {
  border-color: rgba(255, 255, 255, 0.04);
}

.info-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.info-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 5px;
}

.info-item p {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.info-item ul {
  list-style: none;
  font-size: 0.85rem;
  color: var(--color-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 5px;
}

.info-item ul li::before {
  content: "⚡";
  margin-right: 6px;
  color: var(--color-secondary);
}

/* Footer */
.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-muted);
  padding: 15px 0 25px 0;
}

/* Modal Styling */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 17, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  max-width: 480px;
  width: 100%;
  border-color: rgba(0, 242, 254, 0.25);
  animation: modalSlideIn 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}

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

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

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text);
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--color-muted);
  cursor: pointer;
}

.close-btn:hover {
  color: var(--color-text);
}

.modal-body {
  font-size: 0.9rem;
}

.modal-step {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal-step.hidden {
  display: none !important;
}

/* Calibration Step Styles */
.grid-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.grid-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grid-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.grid-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(0, 242, 254, 0.3);
}

.grid-btn.active {
  border-color: var(--color-primary);
  background: rgba(0, 242, 254, 0.05);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.15);
}

.grid-hz {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-primary);
}

.flicker-hz {
  font-size: 0.8rem;
  color: var(--color-secondary);
  font-weight: 600;
  margin-top: 2px;
}

.regions {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 4px;
}

.modal-instruction {
  font-size: 0.85rem;
  color: var(--color-muted);
  line-height: 1.4;
}

.calibration-preview-box {
  background: #050811;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cal-status-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-secondary);
  text-shadow: 0 0 6px var(--color-secondary-glow);
}

.cal-progress-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
}

.modal-button-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 10px;
}

/* Step 3 Success */
.success-icon {
  text-align: center;
  margin-bottom: 5px;
}

.success-icon svg {
  filter: drop-shadow(0 0 8px var(--color-primary-glow));
}

.success-msg {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.calibration-results-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin: 5px 0 15px 0;
}

.calibration-results-table td {
  padding: 12px 15px;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.calibration-results-table td.highlight {
  font-family: var(--font-digital);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary);
  text-shadow: 0 0 6px var(--color-primary-glow);
  text-align: right;
}

.calibration-results-table tr:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Header Badges & Sub-badges */
.header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-sub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--color-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-transform: uppercase;
}

.badge-sub.manual {
  color: var(--color-success);
  border-color: rgba(0, 230, 118, 0.3);
  background: rgba(0, 230, 118, 0.08);
}

/* Exposure Warning HUD Overlay */
.exposure-hud {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 5px 12px;
  border-radius: 6px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  transition: all 0.25s ease;
  border: 1px solid transparent;
}

.exposure-hud.optimal {
  background: rgba(5, 8, 17, 0.75);
  color: var(--color-primary);
  border-color: rgba(0, 242, 254, 0.25);
  text-shadow: 0 0 6px var(--color-primary-glow);
}

.exposure-hud.saturated {
  background: rgba(255, 23, 68, 0.25);
  color: #ff5252;
  border-color: var(--color-error);
  text-shadow: 0 0 8px rgba(255, 23, 68, 0.6);
  animation: pulseWarning 1.2s ease infinite;
}

.exposure-hud.underexposed {
  background: rgba(255, 230, 0, 0.2);
  color: var(--color-secondary);
  border-color: var(--color-secondary);
  text-shadow: 0 0 8px var(--color-secondary-glow);
}

/* Shutter Speed Warning HUD */
.shutter-hud {
  position: absolute;
  top: 42px;
  left: 10px;
  z-index: 5;
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 6px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  background: rgba(255, 87, 34, 0.25);
  color: #ff8a65;
  border: 1px solid #ff5722;
  text-shadow: 0 0 6px rgba(255, 87, 34, 0.5);
  animation: pulseWarning 1.4s ease infinite;
}

/* ROI Status HUD */
.roi-hud {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  border-radius: 4px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  background: rgba(0, 242, 254, 0.1);
  color: var(--color-primary);
  border: 1px solid rgba(0, 242, 254, 0.2);
}

@keyframes pulseWarning {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.02); }
}

/* Sensor Profile Info in Controls Header */
.sensor-profile-info {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Session Recording Card Styles */
.recording-card {
  grid-column: span 1;
}

@media (min-width: 768px) {
  .recording-card {
    grid-column: span 2;
  }
}

.recording-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rec-desc {
  font-size: 0.85rem;
  color: var(--color-muted);
  line-height: 1.4;
}

.rec-progress-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.rec-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary);
}

.rec-button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.export-download-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 5px;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 0.8rem;
}

#start-rec-btn.recording {
  background: var(--color-error);
  box-shadow: 0 0 16px rgba(255, 23, 68, 0.6);
  animation: pulseWarning 1s infinite;
}

/* Cryptographic Audit Hash Badge */
.audit-hash-badge {
  font-family: var(--font-digital);
  font-size: 0.72rem;
  color: var(--color-primary);
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}

/* Strobe Calibration Modal */
.strobe-modal {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.strobe-modal.open {
  opacity: 1;
  pointer-events: all;
}

.strobe-viewport {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #000;
}

.strobe-controls {
  position: relative;
  z-index: 10;
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 500px;
  width: 90%;
}

.strobe-hz-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.strobe-hz-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.strobe-hz-btn.active {
  background: var(--color-primary);
  color: #000;
  border-color: var(--color-primary);
  box-shadow: 0 0 12px var(--color-primary-glow);
}

/* Audit Comparison Table */
.audit-history-container {
  margin-top: 15px;
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.audit-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
  color: var(--color-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 600;
  text-transform: uppercase;
}

.audit-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--color-text);
}

.audit-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-tag-sm {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* Ambient Tare HUD Badge */
.ambient-tare-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(14, 165, 233, 0.25);
  border: 1px solid rgba(14, 165, 233, 0.6);
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}

.clear-tare-btn {
  background: transparent;
  border: none;
  color: #38bdf8;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 2px;
  font-weight: bold;
}
.clear-tare-btn:hover {
  color: #fff;
}

/* Facility Session Controls */
.facility-session-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.facility-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--color-text);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  flex: 2;
  min-width: 140px;
}

.facility-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 8px var(--color-primary-glow);
}

.fixture-input {
  flex: 1;
  min-width: 100px;
}

/* Print Styles for Consolidated Facility Compliance Report */
@media print {
  body {
    background: #ffffff !important;
    color: #111827 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    margin: 0 !important;
    padding: 20px !important;
  }

  header, main, .strobe-modal, .modal, footer {
    display: none !important;
  }

  .printable-report {
    display: block !important;
    color: #111827 !important;
  }

  .print-header {
    border-bottom: 2px solid #0284c7;
    padding-bottom: 12px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }

  .print-header h1 {
    font-size: 20pt;
    margin: 0 0 4pt 0;
    color: #0f172a;
  }

  .print-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px;
    border-radius: 6px;
  }

  .print-meta-box {
    font-size: 9pt;
  }
  .print-meta-box strong {
    display: block;
    color: #64748b;
    font-size: 8pt;
    text-transform: uppercase;
    margin-bottom: 2px;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5pt;
    margin-bottom: 20px;
  }

  .print-table th {
    background: #0f172a !important;
    color: #ffffff !important;
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
  }

  .print-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #e2e8f0;
  }

  .print-badge {
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 7.5pt;
    display: inline-block;
  }
  .print-pass {
    background: #dcfce7 !important;
    color: #166534 !important;
  }
  .print-fail {
    background: #fee2e2 !important;
    color: #991b1b !important;
  }

  .print-footer {
    border-top: 1px solid #cbd5e1;
    padding-top: 10px;
    font-size: 8pt;
    color: #64748b;
    display: flex;
    justify-content: space-between;
  }
}


