:root {
  /* ===== DESIGN SYSTEM V2 TOKENS ===== */
  --bg-app: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #334155;
  --bg-code: #020810;
  --border-subtle: #334155;
  --border-strong: #475569;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-on-brand: #ffffff;

  --brand-primary: #0284c7;
  --brand-primary-hover: #0369a1;
  --brand-success: #16a34a;
  --brand-danger: #dc2626;
  --brand-warning: #d97706;
  --brand-info: #38bdf8;

  /* Spectroscopy semantic tokens */
  --uv-cyan-accent: #38bdf8;
  --uv-purple-accent: #c084fc;

  /* Semantic status tokens (bg / fg pairs) */
  --status-info-bg: rgba(56, 189, 248, 0.12);
  --status-info-fg: #38bdf8;
  --status-info-border: rgba(56, 189, 248, 0.3);
  --status-success-bg: rgba(34, 197, 94, 0.12);
  --status-success-fg: #22c55e;
  --status-success-border: rgba(34, 197, 94, 0.35);
  --status-warning-bg: rgba(251, 191, 36, 0.12);
  --status-warning-fg: #fbbf24;
  --status-warning-border: rgba(251, 191, 36, 0.3);
  --status-danger-bg: rgba(220, 38, 38, 0.12);
  --status-danger-fg: #f87171;
  --status-danger-border: rgba(220, 38, 38, 0.3);
  --status-pending-bg: rgba(30, 41, 59, 0.6);
  --status-pending-fg: #64748b;
  --status-pending-border: #1e293b;

  /* Badge token pairs (light semantic colours — theme-adaptive) */
  --badge-neutral-bg: rgba(71, 85, 105, 0.25);
  --badge-neutral-fg: var(--text-secondary);
  --badge-api-bg: rgba(2, 132, 199, 0.15);
  --badge-api-fg: var(--brand-info);
  --badge-mixture-bg: rgba(217, 119, 6, 0.15);
  --badge-mixture-fg: #fbbf24;
  --badge-difficulty-bg: rgba(22, 163, 74, 0.15);
  --badge-difficulty-fg: #4ade80;
  --badge-runtime-bg: rgba(71, 85, 105, 0.2);
  --badge-runtime-fg: var(--text-muted);

  /* Demo / warning stripe */
  --demo-badge-bg: rgba(217, 119, 6, 0.15);
  --demo-badge-fg: #fbbf24;
  --demo-badge-border: rgba(217, 119, 6, 0.35);

  /* Stepper / form surface */
  --surface-form: var(--bg-surface);
  --surface-form-border: var(--border-subtle);
  --surface-form-input: var(--bg-app);
  --surface-form-input-border: var(--border-strong);
  --surface-form-input-hover-bg: var(--status-info-bg);
  --surface-form-input-hover-border: var(--brand-info);
  --surface-form-input-active-bg: rgba(56, 189, 248, 0.22);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  /* Standard Motion & Spring Curves */
  --transition-spring: 250ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 250ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  /* 8-Point Grid Spacing */
  --space-2: 4px;
  --space-4: 8px;
  --space-6: 12px;
  --space-8: 16px;
  --space-12: 24px;
  --space-16: 32px;
  --space-24: 48px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.3);

  --min-touch-target: 44px;
  --nav-height: 60px;

  --focus-ring: 0 0 0 3px rgba(2, 132, 199, 0.55);
}

/* Projection Mode High Contrast Classroom Styling */
body.projection-mode {
  --bg-app: #ffffff !important;
  --bg-surface: #f8fafc !important;
  --bg-surface-elevated: #e2e8f0 !important;
  --bg-code: #f1f5f9 !important;
  --text-primary: #000000 !important;
  --text-secondary: #1e293b !important;
  --text-muted: #475569 !important;
  --border-subtle: #cbd5e1 !important;
  --border-strong: #94a3b8 !important;
  --brand-primary: #0369a1 !important;
  --brand-info: #0369a1 !important;
  /* Status tokens inverted for white background */
  --status-info-bg: #e0f2fe !important;
  --status-info-fg: #0369a1 !important;
  --status-success-bg: #dcfce7 !important;
  --status-success-fg: #15803d !important;
  --status-warning-bg: #fef3c7 !important;
  --status-warning-fg: #92400e !important;
  --status-danger-bg: #fee2e2 !important;
  --status-danger-fg: #b91c1c !important;
  --status-pending-bg: #f1f5f9 !important;
  --status-pending-fg: #64748b !important;
  /* Badge tokens for light mode */
  --badge-neutral-bg: #f1f5f9 !important;
  --badge-neutral-fg: #334155 !important;
  --badge-api-bg: #e0f2fe !important;
  --badge-api-fg: #0369a1 !important;
  --badge-mixture-bg: #fef3c7 !important;
  --badge-mixture-fg: #92400e !important;
  --badge-difficulty-bg: #dcfce7 !important;
  --badge-difficulty-fg: #15803d !important;
  --badge-runtime-bg: #f1f5f9 !important;
  --badge-runtime-fg: #475569 !important;
  /* Demo badge */
  --demo-badge-bg: #fef3c7 !important;
  --demo-badge-fg: #92400e !important;
  --demo-badge-border: #fde68a !important;
  /* Stepper surfaces */
  --surface-form: #f8fafc !important;
  --surface-form-border: #e2e8f0 !important;
  --surface-form-input: #ffffff !important;
  --surface-form-input-border: #cbd5e1 !important;
  --surface-form-input-hover-bg: #e0f2fe !important;
  --surface-form-input-hover-border: #38bdf8 !important;
  --surface-form-input-active-bg: #bae6fd !important;
}


* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  padding-bottom: calc(var(--nav-height) + 20px);
  overflow-x: hidden;
}

/* ===== RESPONSIVE MOBILE GRID OVERRIDES ===== */
@media (max-width: 768px) {
  .platform-container, main, div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  /* Disabled state styling when method parameters are locked */
  input:disabled, select:disabled, button:disabled, [aria-disabled="true"] {
    opacity: 0.55 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
  }
}

/* ===== ACCORDION & MOBILE INTERACTION SYSTEM ===== */
.method-accordion {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.method-accordion[open] {
  border-color: var(--brand-info);
}
summary.accordion-header {
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  list-style: none;
}
summary.accordion-header::-webkit-details-marker {
  display: none;
}
summary.accordion-header::after {
  content: '▼';
  font-size: 0.7rem;
  color: var(--brand-info);
  transition: transform 0.2s ease;
}
.method-accordion[open] summary.accordion-header::after {
  transform: rotate(180deg);
}
.accordion-content {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-app);
}

/* Floating Quick Scroll Pill */
.floating-scroll-pill {
  position: fixed;
  bottom: 74px;
  right: 14px;
  z-index: 850;
  background: rgba(15, 23, 42, 0.9);
  color: var(--brand-info);
  border: 1px solid rgba(56, 189, 248, 0.4);
  backdrop-filter: blur(8px);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.floating-scroll-pill.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Adaptive Sticky Mobile Action Dock */
.mobile-action-dock {
  display: none;
}

@media (max-width: 640px) {
  .platform-container {
    padding: 8px 10px !important;
    box-sizing: border-box !important;
    padding-bottom: 120px !important; /* Space for fixed bottom dock */
  }
  .app-header {
    padding: 10px 12px !important;
  }
  .app-title {
    font-size: 0.92rem !important;
  }
  .instrument-card,
  .readiness-card,
  .cds-telemetry-strip,
  .cds-timeline-wrap {
    padding: 10px 12px !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }
  .readiness-card {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px 10px !important;
  }
  .playback-controls-bar {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  #uvPauseBtn, #uvResumeBtn, #uvResetBtn, #uvSpeedSelect {
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Sticky Action Dock on Mobile */
  .mobile-action-dock {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    z-index: 900;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-subtle);
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
  }
  .mobile-dock-btn {
    min-height: 44px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    border: none;
    white-space: nowrap;
  }
}

/* Spectral Rainbow Ribbon Scale for UV-Vis & Analytical Graphs */
.spectral-rainbow-ribbon {
  height: 6px;
  width: 100%;
  border-radius: var(--radius-full);
  margin-top: 6px;
  background: linear-gradient(
    to right,
    #3b0764 0%,   /* 200 nm Far UV */
    #581c87 15%,  /* 280 nm Mid UV */
    #7c3aed 30%,  /* 380 nm Near UV / Violet */
    #3b82f6 40%,  /* 450 nm Blue */
    #06b6d4 48%,  /* 490 nm Cyan */
    #22c55e 58%,  /* 530 nm Green */
    #eab308 68%,  /* 580 nm Yellow */
    #f97316 75%,  /* 610 nm Orange */
    #ef4444 85%,  /* 680 nm Red */
    #991b1b 95%,  /* 750 nm Deep Red */
    #450a0a 100%  /* 800 nm Near-IR */
  );
  opacity: 0.85;
}

/* Mobile Landscape Split-Grid Layout */
@media (orientation: landscape) and (max-height: 500px) {
  .uvvis-scan-grid {
    display: grid !important;
    grid-template-columns: minmax(360px, 1.3fr) minmax(280px, 1fr) !important;
    gap: 12px !important;
  }
  .mobile-action-dock {
    display: none !important;
  }
  .platform-container {
    padding-bottom: 70px !important;
  }
}




/* ===== BREADCRUMB TITLE & APP HEADER ===== */
.app-header {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96) 0%, rgba(30, 41, 59, 0.92) 100%) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid rgba(56, 189, 248, 0.25) !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4), inset 0 -1px 0 0 rgba(255, 255, 255, 0.08) !important;
  padding: 12px 20px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
}

.brand-mark {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  text-decoration: none !important;
  color: inherit !important;
  transition: transform 0.2s ease !important;
}
.brand-mark:hover {
  transform: translateY(-1px) !important;
}

.brand-glyph {
  width: 32px !important;
  height: 32px !important;
  background: var(--brand-primary, #0284c7) !important;
  border-radius: var(--radius-sm, 6px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 0.86rem !important;
  font-family: var(--font-mono, monospace) !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35) !important;
  flex-shrink: 0 !important;
}

.brand-info {
  display: flex !important;
  flex-direction: column !important;
  line-height: 1.2 !important;
}

.brand-platform-name {
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  color: #94a3b8 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  font-family: var(--font-mono, monospace) !important;
}

.brand-instrument-title {
  font-size: 1.05rem !important;
  font-weight: 800 !important;
  color: #f8fafc !important;
  letter-spacing: -0.015em !important;
}

.header-tool-btn {
  padding: 6px 12px !important;
  background: rgba(15, 23, 42, 0.85) !important;
  color: #e2e8f0 !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--radius-full, 9999px) !important;
  cursor: pointer !important;
  min-height: 36px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.header-tool-btn:hover {
  background: rgba(30, 41, 59, 0.9) !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
  color: #38bdf8 !important;
}

.header-tool-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
}

/* ===== HIGH-END MODE SELECTOR ===== */
.mode-selector {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  background: rgba(15, 23, 42, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--radius-full) !important;
  padding: 4px !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4) !important;
}

.mode-btn {
  padding: 6px 14px !important;
  border-radius: var(--radius-full) !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  background: transparent !important;
  border: none !important;
  color: #94a3b8 !important;
  cursor: pointer !important;
  min-height: 36px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.mode-btn:hover:not(.active) {
  color: #f1f5f9 !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

.mode-btn.active[data-mode="beginner"],
.mode-btn.active#modeBtnBeginner {
  background: linear-gradient(135deg, #15803d 0%, #22c55e 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.4) !important;
}
.mode-btn.active[data-mode="standard"],
.mode-btn.active#modeBtnStandard {
  background: linear-gradient(135deg, #b45309 0%, #f59e0b 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4) !important;
}
.mode-btn.active[data-mode="advanced"],
.mode-btn.active#modeBtnAdvanced {
  background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4) !important;
}

.demo-badge-btn {
  padding: 6px 12px;
  background: var(--demo-badge-bg);
  color: var(--demo-badge-fg);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--demo-badge-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  min-height: 32px;
  transition: transform 0.1s ease;
}
.demo-badge-btn:active {
  transform: scale(0.96);
}

/* ===== MAINTAINER BADGE IN HEADER ===== */
.header-maintainer-badge,
.nav-maintainer-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  font-family: var(--font-mono, monospace);
  color: var(--text-muted, #94a3b8);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius-full, 9999px);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  transition: all 0.2s ease;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.header-maintainer-badge:hover,
.nav-maintainer-badge:hover {
  color: #f8fafc;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.2);
  transform: translateY(-1px);
}
.header-maintainer-badge .maintainer-handle,
.nav-maintainer-badge .maintainer-handle {
  color: #38bdf8;
  font-weight: 700;
}
.header-maintainer-badge:hover .maintainer-handle,
.nav-maintainer-badge:hover .maintainer-handle {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .header-maintainer-badge,
  .nav-maintainer-badge {
    font-size: 0.68rem;
    padding: 3px 8px;
  }
}
@media (max-width: 480px) {
  .header-maintainer-badge {
    display: none; /* Keep mobile header clean on ultra-narrow screens */
  }
}

/* ===== MAIN CONTENT WRAPPER ===== */
.platform-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px;
}

/* ===== TAB PANELS & SUBTLE FADE TRANSITION ===== */
.tab-panel {
  display: none;
  opacity: 0;
  transition: opacity 150ms ease-in-out;
}
.tab-panel.active {
  display: block;
  opacity: 1;
}

/* ===== INSTRUMENT CARD ===== */
.instrument-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* ===== STATUS & BADGES ===== */
.status-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--status-info-bg);
  color: var(--status-info-fg);
  border: 1px solid var(--status-info-border);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.status-badge.error { background: var(--status-danger-bg); color: var(--status-danger-fg); border-color: var(--status-danger-border); }
.status-badge.success { background: var(--status-success-bg); color: var(--status-success-fg); border-color: var(--status-success-border); }
.status-badge.warning { background: var(--status-warning-bg); color: var(--status-warning-fg); border-color: var(--status-warning-border); }

/* ===== HIGH-END DOUBLE-BEZEL DESIGN SYSTEM (Doppelrand Architecture) ===== */
.double-bezel-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.25rem;
  padding: 6px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
  transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.double-bezel-inner {
  background: rgba(2, 6, 23, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: calc(1.25rem - 6px);
  padding: 14px 16px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

/* Standardized Instrument Visualizer Hero (Fixed 160px desktop / 120px mobile) */
.instrument-visualizer-hero {
  height: 160px;
  min-height: 160px;
  max-height: 160px;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020813;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
}
@media (max-width: 768px) {
  .instrument-visualizer-hero {
    height: 120px;
    min-height: 120px;
    max-height: 120px;
  }
}

/* Mobile Sticky Action Dock */
.mobile-action-dock {
  display: none;
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  padding: 8px 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  z-index: 900;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
}
@media (max-width: 768px) {
  .mobile-action-dock {
    display: flex !important;
    gap: 8px;
    align-items: center;
    justify-content: space-around;
  }
}

/* Tabular Figures & Table Data Alignment */
.tabular-nums {
  font-family: var(--font-mono) !important;
  font-variant-numeric: tabular-nums !important;
}
.text-right {
  text-align: right !important;
}
.text-left {
  text-align: left !important;
}
.text-center {
  text-align: center !important;
}

/* Chromatogram & Spectrum Canvas container - Standardized 380px / 260px */
.chromatogram-container {
  position: relative;
  width: 100%;
  height: 380px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 10px;
  overflow: hidden;
  box-sizing: border-box;
}
@media (max-width: 768px) {
  .chromatogram-container {
    height: 260px;
    min-height: 260px;
  }
}
#graphCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
}

.ghost-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(15, 23, 42, 0.92);
  border: 2px dashed rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  pointer-events: none;
  transition: opacity 150ms ease;
  z-index: 10;
  text-align: center;
  padding: 16px;
}
.ghost-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== STICKY ACTION DOCK & POLISH ===== */
.action-dock {
  position: sticky;
  bottom: 68px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
  margin-top: 12px;
  z-index: 900;
}
.dock-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.dock-buttons.multi {
  grid-template-columns: 1fr 1fr;
}

/* Single 1-Tap CTA & Morph Transition */
#runExperimentBtn {
  background: var(--brand-success);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  width: 100%;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
  margin-bottom: 0;
  transition: background-color 200ms ease, transform 100ms cubic-bezier(0.32, 0.72, 0, 1), box-shadow 200ms ease;
}
#runExperimentBtn:active:not(:disabled) {
  transform: scale(0.98);
}
#runExperimentBtn.running {
  background: var(--brand-danger);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

/* ===== UNIVERSAL 5-TAB NAVIGATION BAR ===== */
.nav-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.nav-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  transition: color 150ms ease, border-color 150ms ease;
  outline: none;
}
.nav-tab-item:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: -2px;
}
.nav-tab-item:active:not(:disabled) {
  transform: scale(0.95);
}
.nav-tab-item .tab-icon {
  font-size: 1.1rem;
  margin-bottom: 1px;
  transition: transform 150ms ease;
}
.nav-tab-item.active .tab-icon {
  transform: translateY(-1px);
}
.nav-tab-item.active {
  color: var(--brand-primary);
  border-top: 2px solid var(--brand-primary);
}
.nav-tab-item:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
  margin-left: 4px;
}

/* ===== SAMPLE BROWSER CARDS & FILTER BAR ===== */
.sample-filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-top: 10px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.sample-filter-bar::-webkit-scrollbar { display: none; }
.filter-pill {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  min-height: 32px;
  transition: all 150ms ease;
}
.filter-pill:active { transform: scale(0.96); }
.filter-pill.active {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.sample-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 100ms ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sample-card:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md);
}
.sample-card:active {
  transform: scale(0.99);
}
.sample-card.selected {
  border: 2px solid var(--brand-primary);
  background: var(--status-info-bg);
}
.sample-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.sample-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 2px 0;
  color: var(--text-primary);
}
.sample-formula {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
.sample-fav-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0;
  min-height: auto;
  transition: transform 150ms ease;
}
.sample-fav-btn:active {
  transform: scale(1.3);
}

.sample-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.tag-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--badge-neutral-bg);
  color: var(--badge-neutral-fg);
}
.tag-badge.api { background: var(--badge-api-bg); color: var(--badge-api-fg); }
.tag-badge.mixture { background: var(--badge-mixture-bg); color: var(--badge-mixture-fg); }
.tag-badge.difficulty { background: var(--badge-difficulty-bg); color: var(--badge-difficulty-fg); }
.tag-badge.runtime { background: var(--badge-runtime-bg); color: var(--badge-runtime-fg); }

/* ===== HARDWARE GAUGE WITH SMOOTH TRANSITION ===== */
meter { width: 100%; height: 14px; border-radius: var(--radius-sm); }
meter::-webkit-meter-optimum-value,
meter::-webkit-meter-suboptimum-value,
meter::-webkit-meter-even-less-good-value {
  transition: width 300ms ease-out;
}

/* ===== FORM CONTROLS & BUTTON TACTILE PRESS ===== */
input[type="range"] { width: 100%; accent-color: var(--brand-primary); cursor: pointer; min-height: var(--min-touch-target); }
button { 
  min-height: var(--min-touch-target);
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 100ms cubic-bezier(0.32, 0.72, 0, 1), background-color 150ms ease, opacity 150ms ease;
}
button:active:not(:disabled) {
  transform: scale(0.98);
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
#pumpBtn { background: var(--brand-primary); color: white; margin-bottom: 0; }
#injectBtn { background: var(--brand-success); color: white; margin-bottom: 0; }

/* ===== RESPONSIVE DESKTOP LAYOUT ===== */
@media (min-width: 900px) {
  body {
    padding-bottom: 0;
  }
  .chromatogram-container {
    height: 480px;
  }
  .nav-tab-bar {
    position: static;
    height: 48px;
    border-top: none;
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: none;
    max-width: 1200px;
    margin: 0 auto 16px auto;
    border-radius: var(--radius-md);
  }
  .action-dock {
    position: static;
    margin-top: 16px;
  }
}

@media (max-width: 340px) {
  .app-header { padding: 8px 12px; }
  .app-title { font-size: 0.9rem; }
  .mode-btn { padding: 3px 8px; font-size: 0.7rem; }
  .nav-tab-item { font-size: 0.65rem; }
  .nav-tab-item .tab-icon { font-size: 1rem; }
}

/* ===== QA SPRINT: ACCESSIBILITY & FOCUS MANAGEMENT ===== */

/* Skip-to-content link — visible only when keyboard-focused */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--brand-primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 99999;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 16px;
}

/* WCAG 2.4.11 compliant focus-visible ring on ALL focusable elements */
*:focus { outline: none; }
*:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Stronger focus for range inputs (often lose ring on Webkit) */
input[type="range"]:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 4px;
}

/* Keyboard-only focus for nav tabs (pointer users already have underline) */
.nav-tab-item:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: -3px;
  border-radius: 0;
}

/* ===== QA SPRINT: REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration:   0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration:  0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== QA SPRINT: HIGH CONTRAST MODE ===== */
@media (forced-colors: active) {
  .status-badge        { forced-color-adjust: none; }
  .sample-card.selected { border: 3px solid ButtonText; }
  .mode-btn.active      { forced-color-adjust: none; }
}

/* ===== QA SPRINT: PRINT STYLES (chromatogram export) ===== */
@media print {
  .nav-tab-bar, .action-dock, .app-header, .mode-selector { display: none !important; }
  .tab-panel { display: block !important; opacity: 1 !important; }
  .chromatogram-container { height: 60vh; }
  body { background: white; color: black; padding: 0; }
}

/* ===== BRAND IDENTITY & LOGO MARK ===== */
.brand-glyph {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.25) 0%, rgba(3, 105, 161, 0.4) 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}
.brand-mark:hover .brand-glyph {
  transform: scale(1.05);
  border-color: #38bdf8;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.45);
}

/* ===== SPRINT U1–U5: AUTHENTIC CDS WORKSPACE & STEPPER CONTROLS ===== */

/* CDS Workstation Telemetry Strip (Sprint U1) */
.cds-telemetry-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.cds-telemetry-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cds-telemetry-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}

.cds-telemetry-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f1f5f9;
  font-family: var(--font-mono);
}

.cds-badge-on {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #34d399;
}

/* guided-step-banner/item/arrow removed C2.1 — RunTimeline is sole workflow indicator */


/* Touch-First Stepper Controls (Sprint U3) */
.stepper-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-form);
  border: 1px solid var(--surface-form-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 10px;
}

.stepper-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stepper-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  background: var(--surface-form-input);
  border: 1px solid var(--surface-form-input-border);
  color: var(--brand-primary);
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}

.step-btn:hover {
  background: var(--surface-form-input-hover-bg);
  border-color: var(--surface-form-input-hover-border);
}

.step-btn:active {
  background: var(--surface-form-input-active-bg);
}

.step-val-display {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 70px;
  text-align: center;
  font-family: var(--font-mono);
}

/* floating-quick-dock, fab-btn, slide-over-drawer, drawer-* removed C2.3 — bottom sheet is sole overlay */


/* Contextual Bottom Sheet Overlay */
.bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.bottom-sheet-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 80vh;
  background: var(--bg-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.bottom-sheet.active {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
  margin: 10px auto 4px;
}

.bottom-sheet-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bottom-sheet-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

@media (max-width: 640px) {
  /* Unified Bottom Sheet Modal Padding on Mobile */
  .bottom-sheet-header {
    padding: 12px 16px !important;
  }
  .bottom-sheet-body {
    padding: 16px !important;
  }
  .uvvis-bottom-sheet {
    padding: 16px !important;
  }

  /* Authentic 16:9 HPLC Chromatogram Widescreen Aspect Ratio on Mobile */
  .chromatogram-container {
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    min-height: 195px !important;
    max-height: 240px !important;
    padding: 8px !important;
  }

  /* Compact Header on Mobile (Prevents 140px vertical blowout) */
  .app-header {
    padding: 8px 12px !important;
  }
  .mode-selector {
    gap: 2px !important;
    padding: 2px !important;
  }
  .mode-btn {
    padding: 4px 8px !important;
    font-size: 0.72rem !important;
    min-height: 44px !important;
  }

  /* Clip the timeline strip so steps 4-5 don't bleed past viewport */
  .cds-timeline-wrap {
    overflow: hidden !important;
  }

  /* Floating Action Dock Positioned Cleanly Above Bottom Nav Bar */
  .floating-quick-dock {
    bottom: 76px !important;
    right: 12px !important;
    z-index: 980 !important;
  }

  .chromatogram-container.morph-pip-active {
    width: 220px !important;
    height: 140px !important;
    bottom: 130px !important;
    left: 12px !important;
  }

  /* whyModalOverlay CSS removed C2.3 — element deleted */
}/* ===== CDS TOOLBAR ===================================================== */

.cds-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 0 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.cds-tool-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  min-height: 28px;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
  white-space: nowrap;
}

.cds-tool-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
}

.cds-tool-btn:focus-visible {
  outline: 2px solid var(--status-info-border);
  outline-offset: 2px;
}

.cds-tool-btn.active {
  color: var(--brand-info);
  border-color: var(--status-info-border);
  background: var(--status-info-bg);
}

@media (max-width: 480px) {
  .cds-toolbar { gap: 1px; }
  .cds-tool-btn { font-size: 0.68rem; padding: 4px 8px; min-height: 32px; }
}

/* ===== CDS RUN TIMELINE ================================================= */
.cds-timeline-wrap {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
}

.cds-timeline-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 8px;
}

.cds-timeline-phases {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.cds-timeline-phases::-webkit-scrollbar { display: none; }

.cds-tl-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  min-width: 56px;
}

.cds-tl-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  margin-bottom: 3px;
  transition: background 200ms ease, border-color 200ms ease;
}

.cds-tl-dot.done    { background: var(--status-success-bg); border: 1.5px solid var(--status-success-fg); color: var(--status-success-fg); }
.cds-tl-dot.active  { background: var(--status-info-bg);    border: 1.5px solid var(--status-info-fg);    color: var(--status-info-fg); }
.cds-tl-dot.pending { background: var(--status-pending-bg); border: 1.5px solid var(--status-pending-border); color: var(--status-pending-fg); }

.cds-tl-name {
  font-size: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  font-weight: 600;
}

.cds-tl-name.done    { color: var(--status-success-fg); }
.cds-tl-name.active  { color: var(--text-primary); }
.cds-tl-name.pending { color: var(--status-pending-fg); }

.cds-tl-connector {
  flex-shrink: 0;
  width: 16px;
  height: 2px;
  background: var(--border-subtle);
  margin: 0 2px;
  margin-bottom: 14px; /* align with dot center */
  transition: background 200ms ease;
}

.cds-tl-connector.done { background: var(--status-success-border); }

.cds-tl-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
}

.cds-tl-progress-fill {
  height: 100%;
  background: #38bdf8;
  border-radius: 2px;
  transition: width 300ms linear;
}

@media (max-width: 480px) {
  .cds-tl-step { min-width: 42px; }
  .cds-tl-dot  { width: 18px; height: 18px; font-size: 0.55rem; }
  .cds-tl-name { font-size: 0.55rem; }
  .cds-tl-connector { width: 10px; }
}

/* ===== REUSABLE INSTRUMENT READINESS CARD ===== */
.readiness-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 12px;
}

.readiness-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.readiness-badge {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.readiness-badge.pending     { background: rgba(148, 163, 184, 0.15); border: 1.5px solid #64748b; color: #94a3b8; }
.readiness-badge.in-progress { background: rgba(245, 158, 11, 0.15); border: 1.5px solid #f59e0b; color: #f59e0b; }
.readiness-badge.complete    { background: rgba(52, 211, 153, 0.15); border: 1.5px solid #34d399; color: #34d399; }


