@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700&family=Outfit:wght@300;400;500;600;700&display=swap');

/* --- Design Tokens & CSS Variables --- */
:root {
  --font-family: 'Outfit', 'Noto Sans TC', sans-serif;
  
  /* Brand & Theme Colors */
  --bg-color: #030611;
  --bg-gradient: radial-gradient(circle at 50% 50%, #0d1532 0%, #040816 100%);
  --panel-bg: rgba(10, 18, 42, 0.45);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-glow: rgba(0, 212, 255, 0.08);
  
  --color-primary: #00d4ff;     /* Ice Blue */
  --color-primary-glow: rgba(0, 212, 255, 0.4);
  --color-secondary: #7f00ff;   /* Cyber Violet */
  --color-secondary-glow: rgba(127, 0, 255, 0.4);
  --color-accent: #d8a75e;      /* Elegant Gold */
  --color-accent-glow: rgba(216, 167, 94, 0.3);
  --color-success: #00f5a0;     /* Emerald Green */
  --color-success-glow: rgba(0, 245, 160, 0.4);
  --color-error: #ff4a70;       /* Neon Coral/Pink */
  
  --text-main: #ffffff;
  --text-muted: #8fa0c5;
  --text-dark: #070c1e;
  
  /* Layout Constants */
  --header-height: 80px;
  --border-radius-lg: 24px;
  --border-radius-md: 16px;
  --border-radius-sm: 8px;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Base & Reset Rules --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(4, 8, 22, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 212, 255, 0.4);
}

/* --- Layout Components --- */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 40px;
}

/* Header */
.app-header {
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  background: rgba(3, 6, 17, 0.7);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--panel-border);
}

.app-title {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.system-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(0, 212, 255, 0.1);
  color: var(--color-primary);
  border: 1px solid rgba(0, 212, 255, 0.2);
  text-transform: uppercase;
}

.privacy-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--color-success);
  background: rgba(0, 245, 160, 0.08);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(0, 245, 160, 0.15);
  font-weight: 500;
}

/* --- Screens & Navigation States --- */
.app-screen {
  flex: 1;
  display: none;
  opacity: 0;
  transform: translateY(15px);
  transition: var(--transition-smooth);
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 30px 20px;
}

.app-screen.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* --- Screen 1: Welcome & Setup Screen --- */
.setup-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
  align-items: start;
}

@media (max-width: 968px) {
  .setup-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

.card-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), inset 0 0 16px var(--panel-glow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--border-radius-lg);
  padding: 35px;
  position: relative;
  overflow: hidden;
}

.card-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
}

.welcome-header h2 {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ffffff 0%, var(--color-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-header p {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 30px;
}

/* Input Styles */
.form-group {
  margin-bottom: 28px;
}

.form-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.form-label span {
  color: var(--color-primary);
  font-weight: bold;
}

/* Chip selections */
.chip-group {
  display: flex;
  gap: 12px;
}

.chip-option {
  flex: 1;
  position: relative;
}

.chip-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.chip-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition-smooth);
  gap: 8px;
}

.chip-label i {
  font-size: 1.5rem;
}

.chip-option input[type="radio"]:checked + .chip-label {
  background: rgba(0, 212, 255, 0.08);
  border-color: var(--color-primary);
  color: var(--text-main);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.15);
}

/* Range Slider */
.slider-container {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(255, 255, 255, 0.02);
  padding: 18px 24px;
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.height-slider {
  flex: 1;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  transition: background 0.3s;
}

.height-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: 0 0 10px var(--color-primary-glow);
  transition: transform 0.1s;
}

.height-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.height-value-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.height-input {
  width: 80px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-sm);
  color: #fff;
  padding: 8px 12px;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  font-family: 'Outfit', sans-serif;
  outline: none;
  transition: var(--transition-smooth);
}

.height-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.unit-label {
  font-weight: 600;
  color: var(--text-muted);
}

/* Sleep style preference cards */
.sleep-pref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.sleep-pref-card {
  position: relative;
}

.sleep-pref-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.sleep-pref-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  text-align: center;
  transition: var(--transition-smooth);
}

.sleep-pref-label img {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.65;
  transition: var(--transition-smooth);
}

.sleep-pref-label span.title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.sleep-pref-label span.desc {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sleep-pref-card input[type="radio"]:checked + .sleep-pref-label {
  background: rgba(216, 167, 94, 0.08);
  border-color: var(--color-accent);
  box-shadow: 0 0 15px rgba(216, 167, 94, 0.15);
}

.sleep-pref-card input[type="radio"]:checked + .sleep-pref-label img {
  opacity: 1;
  filter: drop-shadow(0 0 6px var(--color-accent-glow));
}

/* Elegant Action Buttons */
.btn-primary {
  width: 100%;
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border: none;
  border-radius: var(--border-radius-md);
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 212, 255, 0.5);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* Instructions Panel */
.instructions-panel {
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--border-radius-lg);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.instructions-panel h3 {
  font-size: 1.25rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-accent);
}

.instruction-step {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.instruction-step:last-child {
  margin-bottom: 0;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(216, 167, 94, 0.1);
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Screen 2: Camera Scanning Screen --- */
.scan-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 30px;
  align-items: center;
}

@media (max-width: 968px) {
  .scan-grid {
    grid-template-columns: 1fr;
  }
}

.camera-panel {
  position: relative;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  background: #000;
  border: 2px solid var(--panel-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.camera-panel.locked {
  border-color: var(--color-primary);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
}

.video-stream {
  width: 100%;
  height: auto;
  max-height: 70vh;
  display: block;
  transform: scaleX(-1); /* Mirror camera feed default */
}

.overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  transform: scaleX(-1); /* Mirror matching video default */
}

/* Floating Smart Switch Camera Button with glassmorphism */
.switch-camera-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 15; /* High z-index to overlay on video and canvas */
  width: 44px;
  height: 44px;
  background: rgba(7, 12, 30, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.switch-camera-btn:hover {
  background: rgba(0, 212, 255, 0.15);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: scale(1.08);
}

.switch-camera-btn i {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Scan Phase Badge */
.scan-phase-badge {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(10, 20, 30, 0.85);
  border: 1px solid rgba(0, 212, 255, 0.4);
  padding: 8px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.15);
  transition: var(--transition-smooth);
}

.scan-phase-badge.side-phase {
  border-color: rgba(127, 0, 255, 0.4);
  box-shadow: 0 4px 15px rgba(127, 0, 255, 0.15);
}

.scan-phase-badge #scan-phase-text {
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  letter-spacing: 1px;
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  background-color: var(--color-primary);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--color-primary);
  animation: pulse-ring 1.5s infinite;
}

.scan-phase-badge.side-phase .pulse-indicator {
  background-color: #7f00ff;
  box-shadow: 0 0 8px #7f00ff;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.5);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(0, 212, 255, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0);
  }
}

/* Circular Glowing Silhouette Overlay Guide */
.silhouette-guide {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  width: 75%;
  height: 90%;
  pointer-events: none;
  z-index: 3;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition-smooth);
}

/* Smart layout for portrait mode screen/viewfinder */
@media (max-aspect-ratio: 1/1) {
  .silhouette-guide {
    width: 65%;
    height: 85%;
  }
}

.silhouette-guide.aligned {
  background: rgba(0, 245, 160, 0.015);
  box-shadow: inset 0 0 50px rgba(0, 245, 160, 0.08);
}

.silhouette-guide.aligned svg path {
  stroke: rgba(0, 245, 160, 0.85);
  stroke-dasharray: none;
  filter: drop-shadow(0 0 6px rgba(0, 245, 160, 0.6));
}

.silhouette-guide #silhouette-front-svg {
  display: block;
}
.silhouette-guide #silhouette-side-svg {
  display: none;
}

.silhouette-guide.side-mode #silhouette-front-svg {
  display: none;
}
.silhouette-guide.side-mode #silhouette-side-svg {
  display: block;
}

/* Scanning Overlay Line */
.scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, rgba(0, 212, 255, 0) 0%, var(--color-primary) 50%, rgba(0, 212, 255, 0) 100%);
  box-shadow: 0 0 15px var(--color-primary);
  z-index: 4;
  animation: scan-loop 3.5s linear infinite;
  pointer-events: none;
  opacity: 0.7;
}

@keyframes scan-loop {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

/* Real-time Status Overlay */
.scan-status-overlay {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: rgba(7, 12, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 24px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-error);
  box-shadow: 0 0 8px var(--color-error);
}

.status-dot.active {
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.status-text {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Large Countdown Overlay */
.countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 8, 22, 0.4);
  backdrop-filter: blur(4px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.countdown-overlay.show {
  opacity: 1;
}

.countdown-number {
  font-size: 7rem;
  font-weight: 800;
  color: var(--color-primary);
  text-shadow: 0 0 30px rgba(0, 212, 255, 0.6);
  transform: scale(0.5);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.countdown-overlay.show .countdown-number {
  transform: scale(1.1);
}

.countdown-tip {
  font-size: 1.2rem;
  font-weight: 500;
  color: #fff;
  margin-top: 10px;
  letter-spacing: 1px;
}

/* Scan Tips pane */
.scan-tips-card {
  padding: 30px;
}

.scan-tips-card h3 {
  font-size: 1.3rem;
  color: var(--color-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tip-list {
  list-style: none;
}

.tip-item {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  align-items: flex-start;
  transition: var(--transition-smooth);
}

.tip-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
}

/* Default warning state icon */
.tip-icon::before {
  content: '○';
  font-size: 1.1rem;
  color: var(--color-error);
  font-weight: 800;
  transition: var(--transition-smooth);
}

/* Active aligned/success state */
.tip-item.success {
  color: var(--color-success);
  text-shadow: 0 0 8px rgba(0, 245, 160, 0.15);
}

.tip-item.success .tip-icon::before {
  content: '✓';
  font-size: 1.1rem;
  color: var(--color-success);
  font-weight: 800;
  text-shadow: 0 0 10px var(--color-success-glow);
}

.btn-cancel {
  width: 100%;
  margin-top: 20px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius-md);
  padding: 14px;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Loading Spinner for Calibration initialization */
.camera-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 6;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(0, 212, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--color-primary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Screen 3: Results Dashboard --- */
.results-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 30px;
  align-items: start;
}

@media (max-width: 968px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
}

/* Left Results Column: Visualizer */
.visualizer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  min-height: 480px;
}

.visualizer-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.svg-body-canvas {
  width: 100%;
  max-width: 320px;
  height: auto;
  filter: drop-shadow(0 0 15px rgba(0, 212, 255, 0.15));
}

/* Interactive SVG path highlighting styles */
.body-outline {
  fill: rgba(13, 21, 50, 0.6);
  stroke: rgba(0, 212, 255, 0.25);
  stroke-width: 2px;
  transition: var(--transition-smooth);
}

.body-joint {
  fill: #fff;
  stroke: var(--color-primary);
  stroke-width: 2px;
  r: 4;
}

.measurement-line {
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 2px;
  stroke-dasharray: 4 4;
  transition: var(--transition-smooth);
}

.measurement-line.active {
  stroke: var(--color-primary);
  stroke-width: 3px;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 8px var(--color-primary));
}

.measurement-text {
  font-size: 10px;
  fill: var(--text-muted);
  text-anchor: middle;
  font-weight: bold;
  opacity: 0;
  transition: var(--transition-smooth);
}

.measurement-text.active {
  fill: #fff;
  opacity: 1;
}

/* Right Results Column: Dashboard Details */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.dashboard-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
}

.toggle-unit-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 16px;
  border-radius: 20px;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.toggle-unit-btn:hover {
  background: rgba(0, 212, 255, 0.08);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* Measurement Items Grid */
.measurements-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 30px;
}

@media (max-width: 480px) {
  .measurements-grid {
    grid-template-columns: 1fr;
  }
}

.measure-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-md);
  padding: 16px 20px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.measure-card:hover, .measure-card.active {
  background: rgba(0, 212, 255, 0.04);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 212, 255, 0.08);
}

.measure-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.measure-card-header i {
  color: var(--color-primary);
}

.measure-val {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  font-family: 'Outfit', sans-serif;
}

.measure-val span {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

/* Sleep tech recommendations card */
.sleep-recommendation-panel {
  border: 1px solid rgba(216, 167, 94, 0.18);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35), inset 0 0 12px var(--color-accent-glow);
  background: rgba(20, 16, 32, 0.5);
  margin-bottom: 30px;
}

.sleep-recommendation-panel::before {
  background: linear-gradient(90deg, var(--color-accent), #f3c68f);
}

.rec-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.rec-title-wrap img.logo {
  height: 28px;
  object-fit: contain;
}

.rec-title-wrap h3 {
  font-size: 1.25rem;
  color: var(--color-accent);
  font-weight: 700;
}

.rec-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 24px;
  margin-bottom: 24px;
}

@media (max-width: 600px) {
  .rec-split {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.rec-item {
  display: flex;
  flex-direction: column;
}

.rec-item-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.rec-val-large {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  margin-bottom: 8px;
  line-height: 1;
}

.rec-val-large span.unit {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

.rec-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.rec-desc span.highlight {
  color: var(--color-accent);
  font-weight: 600;
}

/* Sleep custom mattress fit */
.mattress-fit-box {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.mattress-fit-icon {
  width: 44px;
  height: 44px;
  background: rgba(216, 167, 94, 0.1);
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.mattress-fit-content h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.mattress-fit-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.rec-actions {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

@media (max-width: 480px) {
  .rec-actions {
    flex-direction: column;
  }
}

.btn-accent {
  flex: 1;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--color-accent) 0%, #aa7c3b 100%);
  border: none;
  border-radius: var(--border-radius-md);
  color: var(--text-dark);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(216, 167, 94, 0.2);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(216, 167, 94, 0.4);
  filter: brightness(1.1);
}

.btn-outline {
  flex: 1;
  padding: 14px 24px;
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

/* Re-capture Footer Button */
.results-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 24px;
}

.body-shape-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(127, 0, 255, 0.1);
  border: 1px solid rgba(127, 0, 255, 0.2);
  color: #cf9fff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.body-shape-badge i {
  color: #a855f7;
}

.recapture-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 24px;
  border-radius: var(--border-radius-md);
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 8px;
}

.recapture-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

/* --- Footer Copyright & Info --- */
.app-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 40px;
}

/* ==================================================== */
/* COMPREHENSIVE RESPONSIVE ADAPTIVE LAYOUTS (RWD)     */
/* ==================================================== */

/* Tablet & iPad Portrait / Landscape Breakpoints */
@media (max-width: 1024px) {
  .app-screen {
    padding: 24px 16px;
  }
  
  .setup-grid, .scan-grid, .results-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .card-panel {
    padding: 28px;
  }
}

/* iPad Portrait & Small Tablets (<= 768px) */
@media (max-width: 768px) {
  :root {
    --header-height: 70px;
  }
  
  .app-header {
    padding: 0 24px;
  }
  
  .brand-logo {
    height: 32px;
  }
  
  .app-title {
    font-size: 0.95rem;
  }
  
  .privacy-tag {
    font-size: 0.75rem;
    padding: 4px 12px;
  }
  
  .welcome-header h2 {
    font-size: 1.8rem;
  }
  
  .card-panel {
    padding: 24px;
  }
}

/* Mobile Phones (<= 480px) */
@media (max-width: 480px) {
  .app-header {
    height: auto;
    min-height: 80px;
    padding: 12px 16px;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    align-items: center;
    text-align: center;
  }
  
  .brand-container {
    flex-direction: column;
    gap: 6px;
  }
  
  .brand-divider {
    display: none;
  }
  
  .brand-logo {
    height: 28px;
  }
  
  .app-title {
    font-size: 0.85rem;
  }
  
  .privacy-tag {
    width: 100%;
    justify-content: center;
  }
  
  .welcome-header h2 {
    font-size: 1.5rem;
  }
  
  .welcome-header p {
    font-size: 0.9rem;
    margin-bottom: 20px;
  }
  
  .card-panel {
    padding: 20px 16px;
    border-radius: var(--border-radius-md);
  }
  
  /* Stack sleep preferences to be very readable on small screens */
  .sleep-pref-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .sleep-pref-label {
    padding: 12px;
    flex-direction: row;
    text-align: left;
    gap: 12px;
    align-items: center;
  }
  
  .sleep-pref-label img {
    width: 36px;
    height: 36px;
    margin-bottom: 0;
  }
  
  .sleep-pref-label span.title {
    font-size: 0.9rem;
    margin-bottom: 2px;
  }
  
  .sleep-pref-label span.desc {
    font-size: 0.7rem;
  }
  
  /* Scale down measurement result fonts on narrow mobile */
  .measure-val {
    font-size: 1.5rem;
  }
  
  .rec-val-large {
    font-size: 1.8rem;
  }
  
  .rec-split {
    gap: 16px;
  }
}

/* ====================================================
   REPORT MODAL OVERLAY & DIALOG (GLASSMORPHISM)
   ==================================================== */
/* --- CLINICAL MEDICAL REPORT STYLES (PREVIEW & PRINT) --- */

.report-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 6, 17, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 20px;
}

.report-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Modal Box - Premium dark glass wrapper around medical report */
.report-modal-box.medical-style {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), inset 0 0 32px var(--panel-glow);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 900px; /* Wider for A4 side-by-side contents */
  height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.report-modal-overlay.active .report-modal-box.medical-style {
  transform: scale(1) translateY(0);
}

/* Sticky top control bar */
.report-modal-control-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: rgba(10, 15, 30, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.report-modal-control-bar .control-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-modal-control-bar .control-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.report-modal-control-bar .control-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-control-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-print-report {
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-primary) 100%);
  border: none;
  color: var(--text-dark);
  box-shadow: 0 4px 12px rgba(0, 245, 160, 0.2);
}

.btn-print-report:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 245, 160, 0.3);
}

.btn-copy-report {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-copy-report:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.report-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.report-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-error);
}

/* Scrollable Container - Simulating paper-like A4 card inside screen */
.report-modal-body.medical-print-sheet {
  background: #0b0f19 !important; /* Premium dark slate background to stack paper-like A4 sheets */
  color: #2d3748 !important;
  padding: 30px !important;
  overflow-y: auto;
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  font-family: 'Inter', 'Noto Sans TC', system-ui, sans-serif !important;
}

/* Premium A4 sheet emulation on screen */
.medical-report-page {
  background: #ffffff !important;
  color: #2d3748 !important;
  width: 210mm;
  height: 297mm;
  min-height: 297mm;
  padding: 8mm 12mm;
  box-sizing: border-box;
  position: relative;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 5px 15px rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .report-modal-body.medical-print-sheet {
    padding: 10px !important;
    gap: 15px;
  }
  .medical-report-page {
    width: 100% !important;
    height: auto !important;
    min-height: unset !important;
    padding: 15px 15px !important;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  }
}

/* Watermark background on screen */
.medical-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 4rem;
  font-weight: 900;
  color: rgba(12, 74, 96, 0.03);
  letter-spacing: 5px;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}

/* Report Header */
.medical-report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
  position: relative;
}

.header-logo-side {
  display: flex;
  align-items: center;
  gap: 15px;
}

.report-brand-logo {
  height: 48px;
  width: auto;
  filter: contrast(1.1) brightness(0.9); /* Perfect clean rendering */
}

.header-lab-title h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0c4a60; /* Clinic Deep Teal */
  margin: 0;
  letter-spacing: 0.5px;
}

.header-lab-title p {
  font-size: 0.65rem;
  font-weight: 500;
  color: #718096;
  margin: 2px 0 0 0;
  letter-spacing: 0.2px;
}

.header-title-side {
  text-align: right;
}

.medical-title-badge {
  display: inline-block;
  background: #e6fffa;
  border: 1px solid #b2f5ea;
  color: #0c4a60;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 1.5px;
  padding: 4px 10px;
  border-radius: 4px;
  text-shadow: none;
}

.report-id-text {
  font-size: 0.65rem;
  font-weight: 600;
  color: #718096;
  margin: 4px 0 0 0;
}

.medical-divider-double {
  height: 5px;
  border-top: 2px solid #0c4a60;
  border-bottom: 1px solid #0c4a60;
  margin: 10px 0;
  z-index: 2;
  position: relative;
}

/* Medical Grid rows & columns */
.medical-row {
  display: flex;
  gap: 12px;
  z-index: 2;
  position: relative;
}

.medical-col-6 {
  flex: 0 0 calc(50% - 10px);
  width: calc(50% - 10px);
}

.medical-col-7 {
  flex: 0 0 calc(58% - 10px);
  width: calc(58% - 10px);
}

.medical-col-5 {
  flex: 0 0 calc(41.66% - 13.3px);
  width: calc(41.66% - 13.3px);
}

.medical-col-4 {
  flex: 0 0 calc(33.33% - 13.3px);
  width: calc(33.33% - 13.3px);
}

.medical-col-3 {
  flex: 0 0 calc(25% - 13.3px);
  width: calc(25% - 13.3px);
}

.medical-col-12 {
  flex: 0 0 100%;
  width: 100%;
}

.medical-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: #0c4a60;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  border-left: 3px solid #0c4a60;
  padding-left: 8px;
}

.medical-section-title i {
  width: 14px;
  height: 14px;
  stroke-width: 2.5px;
}

/* Medical Diagnostic Tables */
.medical-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.64rem;
  line-height: 1.35;
  margin-bottom: 4px;
}

.medical-report-table th, .medical-report-table td {
  padding: 2px 5px;
  border: 1px solid #e2e8f0;
  text-align: left;
}

.medical-report-table th {
  background: #f7fafc;
  color: #4a5568;
  font-weight: 700;
}

.medical-report-table td {
  color: #2d3748;
}

/* Hoverable table rows */
.hoverable-table tbody tr:hover {
  background: #f0fdf4;
}

.medical-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 4px;
}

.medical-badge.normal {
  background: #c6f6d5;
  color: #22543d;
  border: 1px solid #9ae6b4;
}

.medical-badge.warning {
  background: #feebc8;
  color: #744210;
  border: 1px solid #fbd38d;
}

.medical-badge.danger {
  background: #fed7d7;
  color: #742a2a;
  border: 1px solid #feb2b2;
}

.shape-diagnosis-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e6f4ea;
  border: 1px solid #c2e7d9;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 0.62rem;
  color: #1b5e20;
  margin-top: 4px;
}

.shape-diagnosis-bar i {
  stroke-width: 2.5px;
}

/* Diagnostic Spine card */
.medical-diagnose-card {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fafbfe;
  padding: 6px 8px;
  height: calc(100% - 24px); /* Stretch to fit */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prescription-row {
  display: flex;
  gap: 8px;
}

.prescription-pill-box {
  flex: 1;
  background: #f0f4f8;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.prescription-pill-box .pill-label {
  font-size: 0.52rem;
  font-weight: 600;
  color: #64748b;
}

.prescription-pill-box .pill-value {
  font-size: 0.8rem;
  font-weight: 800;
  color: #0c4a60;
  margin-top: 1px;
}

.diagnostic-narrative {
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 5px;
  padding: 5px 8px;
  flex: 1;
  overflow-y: auto;
}

/* Medical Mattress Recommendation Section */
.medical-mattress-prescription-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex: 1;
}

.medical-prescription-card {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.medical-prescription-card::before {
  content: 'PRESCRIPTION ONLY';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.5rem;
  font-weight: 800;
  color: rgba(229, 62, 98, 0.2);
  border: 1px solid rgba(229, 62, 98, 0.2);
  border-radius: 3px;
  padding: 1px 4px;
  pointer-events: none;
}

.med-mattress-image-wrap {
  width: 100%;
  height: 44px;
  border-radius: 4px;
  overflow: hidden;
  background: #f7fafc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.med-mattress-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.med-mattress-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.med-mattress-name-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
}

.med-mattress-name-row h4 {
  font-size: 0.64rem;
  font-weight: 800;
  color: #2d3748;
  margin: 0;
  line-height: 1.3;
}

.med-match-score {
  font-size: 0.6rem;
  font-weight: 800;
  color: #e53e3e; /* Medical Red for high match rating */
  white-space: nowrap;
}

.med-mattress-specs {
  font-size: 0.54rem;
  color: #718096;
  font-weight: 500;
}

.med-hardness-indicator {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 1px 0;
}

.med-hardness-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.56rem;
  color: #718096;
  font-weight: 600;
}

.med-hardness-bar-bg {
  height: 4px;
  background: #edf2f7;
  border-radius: 2px;
  overflow: hidden;
}

.med-hardness-bar-fill {
  height: 100%;
  background: #319795;
  border-radius: 2px;
}

.med-mattress-features {
  font-size: 0.54rem;
  line-height: 1.3;
  color: #4a5568;
  background: #f7fafc;
  border-radius: 4px;
  padding: 3px 4px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.med-mattress-features div {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.med-mattress-features i {
  stroke-width: 3px;
  margin-top: 2px;
  flex-shrink: 0;
}

.med-mattress-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
  border-top: 1px dashed #e2e8f0;
  padding-top: 5px;
}

.med-orig-price {
  font-size: 0.56rem;
  color: #a0aec0;
  text-decoration: line-through;
}

.med-sale-price {
  font-size: 0.7rem;
  font-weight: 800;
  color: #e53e3e;
}

.btn-med-buy {
  background: #0c4a60;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.58rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.2s;
  margin-top: 2px;
}

.btn-med-buy:hover {
  background: #083344;
}

/* Signatures & Stamper Section */
.medical-report-footer {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #0c4a60;
  padding-top: 8px;
  position: relative;
  z-index: 2;
}

.footer-sign-col {
  flex: 0 0 38%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.footer-inst {
  font-size: 0.6rem;
  color: #a0aec0;
  margin: 0;
}

.signature-line {
  font-size: 0.7rem;
  font-weight: 700;
  color: #4a5568;
  display: flex;
  align-items: baseline;
  border-bottom: 1px solid #718096;
  padding-bottom: 3px;
}

/* Beautiful cursive-style font for medical specialist signature */
.signature-font {
  font-family: 'Georgia', 'Playfair Display', cursive, serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a365d;
  font-style: italic;
  margin-left: 5px;
  letter-spacing: 0.5px;
}

/* Red Stamp Overlay */
.stamp-wrapper {
  position: absolute;
  right: 15px;
  bottom: 0px;
  width: 90px;
  height: 90px;
  pointer-events: none;
  z-index: 10;
}

.official-stamp-circle {
  width: 100%;
  height: 100%;
  opacity: 0.85;
  transform: rotate(-8deg);
}

.stamp-text-curved {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.text-success {
  color: #38a169 !important;
  font-weight: 700;
}


/* --- CSS @media print RULES (A4 PRINT OPTIMIZATION) --- */
@media print {
  /* Hide standard screen container elements completely */
  body, html {
    background: #ffffff !important;
    color: #000000 !important;
  }
  
  .app-container, .report-modal-control-bar, .report-modal-overlay::before {
    display: none !important;
  }

  /* Make modal take over the entire screen and strip down modal effects */
  .report-modal-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: auto !important;
    background: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    padding: 0 !important;
    display: block !important;
  }

  .report-modal-box.medical-style {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    border-radius: 0 !important;
    transform: none !important;
    display: block !important;
    overflow: visible !important;
  }

  .report-modal-body.medical-print-sheet {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    overflow: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    box-sizing: border-box !important;
  }

  .medical-report-page {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    padding: 8mm 12mm !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    page-break-after: always !important;
    page-break-inside: avoid !important;
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* Avoid background clipping */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Force A4 Page Size rules with 0 margin to prevent double-margin shifts */
  @page {
    size: A4 portrait;
    margin: 0 !important;
  }

  /* Hide print buttons and purchase links from printed sheet */
  .btn-med-buy, .ios-print-tip-banner {
    display: none !important;
  }

  .medical-prescription-card {
    border: 1px solid #cbd5e1 !important;
    padding: 8px !important;
  }

  /* Watermark and stamp look sharp in print */
  .medical-watermark {
    color: rgba(12, 74, 96, 0.04) !important;
  }

  .stamp-wrapper {
    right: 20px !important;
    bottom: 5px !important;
  }
}

@media (max-width: 576px) {
  .report-modal-actions {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 16px 20px 20px 20px;
  }
  .report-modal-header {
    padding: 20px 20px 12px 20px;
  }
  .report-modal-body {
    padding: 16px 20px;
  }
}

/* ====================================================
   SLEEP HABITS QUESTIONNAIRE CARD STYLES
   ==================================================== */
.questionnaire-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-md);
  margin-top: 12px;
  margin-bottom: 24px;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.questionnaire-card:hover {
  border-color: rgba(216, 167, 94, 0.2);
  box-shadow: 0 0 15px rgba(216, 167, 94, 0.05);
}

.q-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.01);
  transition: var(--transition-smooth);
}

.q-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.q-header-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.q-header-title h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.q-header-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.q-chevron {
  color: var(--text-muted);
  transition: transform 0.3s ease;
  width: 20px;
  height: 20px;
}

.questionnaire-card.expanded {
  border-color: rgba(216, 167, 94, 0.25);
  box-shadow: inset 0 0 10px rgba(216, 167, 94, 0.03);
}

.questionnaire-card.expanded .q-chevron {
  transform: rotate(180deg);
  color: var(--color-accent);
}

.q-body {
  padding: 24px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: rgba(3, 6, 17, 0.3);
}

.q-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.q-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.q-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Radio chips */
.q-chip {
  position: relative;
  cursor: pointer;
}

.q-chip input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.q-chip span {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: var(--transition-smooth);
}

.q-chip input[type="radio"]:checked + span {
  background: rgba(216, 167, 94, 0.1);
  border-color: var(--color-accent);
  color: var(--text-main);
  box-shadow: 0 0 10px rgba(216, 167, 94, 0.15);
}

/* Checkbox chips */
.q-chip-checkbox {
  position: relative;
  cursor: pointer;
}

.q-chip-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.q-chip-checkbox span {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: var(--transition-smooth);
}

.q-chip-checkbox input[type="checkbox"]:checked + span {
  background: rgba(0, 212, 255, 0.08);
  border-color: var(--color-primary);
  color: var(--text-main);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.15);
}

/* ====================================================
   MATTRESS RECOMMENDATION CARD STYLES
   ==================================================== */
.rec-panel-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 6px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.mattress-cards-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mattress-rec-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  padding: 24px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.mattress-rec-card:hover {
  border-color: rgba(0, 212, 255, 0.25);
  box-shadow: 0 10px 30px rgba(0, 212, 255, 0.08);
  transform: translateY(-2px);
}

.mattress-rec-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--color-success);
}

.mattress-card-image-wrap {
  width: 100%;
  height: 100%;
  min-height: 200px;
  max-height: 280px;
  background: #ffffff;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: var(--transition-smooth);
}

.mattress-rec-card:hover .mattress-card-image-wrap {
  border-color: rgba(0, 212, 255, 0.15);
}

.mattress-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.mattress-rec-card:hover .mattress-card-img {
  transform: scale(1.05);
}

.mattress-card-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mattress-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.mattress-name-wrap h4 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.mattress-brand-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(0, 245, 160, 0.1);
  color: var(--color-success);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0, 245, 160, 0.15);
  text-transform: uppercase;
}

.mattress-height-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mattress-price-wrap {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.mattress-price-original {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.mattress-price-sale {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-accent);
  text-shadow: 0 0 10px rgba(216, 167, 94, 0.2);
}

.mattress-desc-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-left: 2px solid rgba(255, 255, 255, 0.05);
  padding-left: 12px;
}

.mattress-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  background: rgba(255, 255, 255, 0.01);
  padding: 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.mattress-feature-item {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mattress-feature-item i {
  color: var(--color-primary);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.hardness-meter-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.hardness-meter-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.hardness-bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.hardness-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 3px;
}

.mattress-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mattress-tag {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mattress-tag.match {
  background: rgba(0, 212, 255, 0.06);
  color: var(--color-primary);
  border-color: rgba(0, 212, 255, 0.15);
}

.btn-buy-mattress {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: rgba(216, 167, 94, 0.08);
  border: 1px solid rgba(216, 167, 94, 0.2);
  border-radius: var(--border-radius-sm);
  color: var(--color-accent);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-buy-mattress:hover {
  background: linear-gradient(135deg, var(--color-accent) 0%, #bd904a 100%);
  border-color: transparent;
  color: var(--text-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(216, 167, 94, 0.25);
}

/* Questionnaire chips customization */
.q-chips.flex-column {
  flex-direction: column !important;
  align-items: stretch !important;
  width: 100%;
}

.q-chips.flex-column .q-chip {
  width: 100%;
}

.q-chips.flex-column .q-chip input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.q-chips.flex-column .q-chip span {
  width: 100%;
  border-radius: 12px;
  padding: 12px 18px;
  text-align: left;
  display: block;
  box-sizing: border-box;
}

/* ====================================================
   WIZARD STEP-BY-STEP QUESTIONNAIRE STYLES
   ==================================================== */

/* Progress Header */
.wizard-progress-container {
  margin-bottom: 30px;
  background: rgba(255, 255, 255, 0.01);
  padding: 20px;
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.wizard-progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

.wizard-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 50%, var(--color-accent) 100%);
  box-shadow: 0 0 12px var(--color-primary-glow);
  width: 25%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Steps Indicators */
.wizard-steps-indicator {
  display: flex;
  justify-content: space-between;
  position: relative;
}

.step-indicator-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  position: relative;
  transition: var(--transition-smooth);
}

.step-indicator-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition-smooth);
  z-index: 2;
}

.step-indicator-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition-smooth);
  text-align: center;
}

/* Active State */
.step-indicator-item.active .step-indicator-num {
  background: rgba(0, 212, 255, 0.15);
  border-color: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
  transform: scale(1.1);
}

.step-indicator-item.active .step-indicator-label {
  color: var(--color-primary);
  font-weight: 600;
}

/* Completed State */
.step-indicator-item.completed .step-indicator-num {
  background: rgba(0, 245, 160, 0.15);
  border-color: var(--color-success);
  color: var(--color-success);
  box-shadow: 0 0 12px rgba(0, 245, 160, 0.3);
}

.step-indicator-item.completed .step-indicator-label {
  color: var(--color-success);
}

/* Wizard step slides & animations */
.wizard-step {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: wizardStepFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.wizard-step.active {
  display: flex !important;
}

@keyframes wizardStepFadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wizard-step-intro {
  margin-bottom: 8px;
}

.wizard-step-intro h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  background: linear-gradient(90deg, #fff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.wizard-step-intro p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Wizard Navigation Row */
.wizard-navigation {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.wizard-navigation button {
  padding: 12px 28px;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.wizard-navigation .btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wizard-navigation .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.wizard-navigation .btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border: none;
  color: var(--text-dark);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
}

.wizard-navigation .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4);
  filter: brightness(1.1);
}

.wizard-navigation .btn-start-scan {
  background: linear-gradient(135deg, var(--color-accent) 0%, #ab7f3c 100%) !important;
  color: var(--text-dark) !important;
  box-shadow: 0 4px 15px rgba(216, 167, 94, 0.2) !important;
}

.wizard-navigation .btn-start-scan:hover {
  box-shadow: 0 8px 25px rgba(216, 167, 94, 0.45) !important;
}

@media (max-width: 768px) {
  .mattress-rec-card {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }
  
  .mattress-card-image-wrap {
    height: 200px;
  }
  
  .mattress-card-top {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .mattress-price-wrap {
    text-align: left;
    align-items: flex-start;
  }
  
  .wizard-progress-container {
    padding: 12px;
  }
  
  .step-indicator-label {
    display: none;
  }
}

/* --- CUSTOMER INFO FORM STYLING --- */
.text-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-sm);
  color: #fff;
  padding: 12px 16px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition-smooth);
}
.text-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}


/* --- V1.6.0 DUAL SHAPE VISUALIZER & SEGMENT RIBBON STYLES --- */
.segment-divider {
  transition: var(--transition-smooth);
}
.segment-overlay-zone {
  transition: opacity var(--transition-smooth);
  pointer-events: none;
}
.svg-group {
  cursor: pointer;
}
.svg-group:hover .measurement-line {
  stroke-width: 3px;
  stroke-dasharray: none;
}
.spine-curve {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: drawSpine 2.5s ease-out forwards;
}
@keyframes drawSpine {
  to {
    stroke-dashoffset: 0;
  }
}

/* 5-Segment Ribbon Layout */
.segment-ribbon-container {
  width: 100%;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ribbon-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}
.pulse-indicator {
  width: 8px;
  height: 8px;
  background-color: var(--color-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-primary);
  animation: pulseGrad 1.8s infinite;
}
@keyframes pulseGrad {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 12px var(--color-primary); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.segment-ribbon {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
}
@media (max-width: 768px) {
  .segment-ribbon {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.segment-ribbon-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.segment-ribbon-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}
.segment-ribbon-item.active {
  background: rgba(255, 255, 255, 0.08);
  border-width: 1.5px !important;
}

.segment-ribbon-item-header {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.segment-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.segment-name-label {
  flex-grow: 1;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.segment-len-label {
  color: rgba(255,255,255,0.4);
}

.segment-energy-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
.segment-energy-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1.2s cubic-bezier(0.1, 0.8, 0.2, 1);
}

.segment-ribbon-item-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
}
.segment-pct-val {
  color: var(--text-main);
}
.segment-mass-val {
  color: var(--color-secondary);
}

/* Detail Card Box */
.segment-detail-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3.5px solid var(--color-primary);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition-smooth);
}
.detail-segment-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-segment-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: var(--transition-smooth);
}
.detail-segment-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}
.detail-segment-rec {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 12px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.detail-segment-desc {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 0;
}

/* ====================================================
   IPAD / IOS SPECIAL IMAGE PREVIEW MODAL OVERLAY STYLES
   ==================================================== */
.ios-image-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 6, 17, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 3000; /* Higher than report modal (2000) */
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 16px;
}

.ios-image-preview-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.ios-preview-box {
  background: #0f172a; /* iOS-friendly dark theme */
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8), inset 0 0 32px rgba(255, 255, 255, 0.02);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 600px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transform: scale(0.92) translateY(15px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.ios-image-preview-overlay.active .ios-preview-box {
  transform: scale(1) translateY(0);
}

.ios-preview-header {
  padding: 14px 20px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.ios-preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text-main);
  font-size: 1.05rem;
}

.ios-preview-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  font-weight: 300;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-fast);
}

.ios-preview-close:hover {
  color: var(--color-danger);
}

.ios-preview-body {
  padding: 16px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.ios-tip-banner {
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: var(--border-radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
}

.ios-tip-banner p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #e0f2fe;
}

.ios-tip-banner strong {
  color: var(--color-accent);
}

.ios-preview-image-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px;
  user-select: contain; /* Enable native iOS long press target centering */
  -webkit-user-select: contain;
}

.ios-preview-img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  user-select: auto !important; /* Force browser to allow long press saving */
  -webkit-user-select: auto !important;
  cursor: pointer;
  -webkit-touch-callout: default !important; /* Standard iOS touch callout for image saving sheet */
}

.ios-preview-footer {
  padding: 14px 20px;
  background: #1e293b;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.btn-ios-action {
  flex: 1;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-ios-action:hover {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  transform: translateY(-1px);
}

.btn-ios-close {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-ios-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* iPad / iOS print info guide banner in main report */
.ios-print-tip-banner {
  background: rgba(245, 158, 11, 0.1);
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fef3c7;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* ====================================================
   LINE / FACEBOOK IN-APP BROWSER GUIDANCE OVERLAY STYLES
   ==================================================== */
.inapp-browser-guide-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 6, 17, 0.92);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  z-index: 4000; /* Higher than iOS preview (3000) */
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 16px;
}

.inapp-browser-guide-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.inapp-guide-box {
  background: #0f172a;
  border: 1px solid rgba(245, 158, 11, 0.3); /* Subtle amber border to indicate guide/attention */
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(245, 158, 11, 0.05);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transform: scale(0.92) translateY(15px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.inapp-browser-guide-overlay.active .inapp-guide-box {
  transform: scale(1) translateY(0);
}

.inapp-guide-header {
  padding: 16px 20px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.inapp-guide-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #f59e0b; /* Accent warning amber */
  font-size: 1.1rem;
}

.inapp-guide-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  font-weight: 300;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-fast);
}

.inapp-guide-close:hover {
  color: var(--color-danger);
}

.inapp-guide-body {
  padding: 20px 24px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.inapp-warning-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--border-radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.inapp-warning-banner div strong {
  display: block;
  font-size: 0.9rem;
  color: #fef3c7;
  margin-bottom: 4px;
}

.inapp-warning-banner div p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #fcd34d;
}

.inapp-steps-container h4 {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-top: 0;
  margin-bottom: 12px;
  font-weight: 600;
}

.inapp-step-item {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.inapp-step-item:last-child {
  margin-bottom: 0;
}

.step-badge {
  background: #f59e0b;
  color: #0f172a;
  font-size: 0.85rem;
  font-weight: 800;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-content strong {
  display: block;
  font-size: 0.88rem;
  color: var(--color-accent);
  margin-bottom: 4px;
}

.step-content p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.inapp-guide-footer {
  padding: 16px 24px;
  background: #1e293b;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.btn-inapp-safari-now {
  flex: 1.2;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 11px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-inapp-safari-now:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
  transform: translateY(-1px);
}

.btn-inapp-close {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 11px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-inapp-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* ====================================================
   ALL PRODUCTS RANKING MODAL (GLASSMORPHISM)
   ==================================================== */
.all-products-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 6, 17, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 2100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 20px;
}

.all-products-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.all-products-modal-box {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), inset 0 0 32px var(--panel-glow);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 800px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.all-products-modal-overlay.active .all-products-modal-box {
  transform: scale(1) translateY(0);
}

.all-products-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(10, 15, 30, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.all-products-modal-header .modal-title-with-icon {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-pulse-blue {
  background: rgba(2, 132, 199, 0.15);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(2, 132, 199, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.all-products-modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.all-products-modal-header p {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}

.all-products-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition-smooth);
}

.all-products-modal-close:hover {
  color: var(--color-error);
}

.all-products-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ranking-info-banner {
  display: flex;
  gap: 12px;
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.15);
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  align-items: center;
}

.ranking-info-banner p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #93c5fd;
}

.all-products-table-container {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-sm);
  background: rgba(10, 15, 30, 0.4);
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

/* Scrollbar styles for modal body and table */
.all-products-modal-body::-webkit-scrollbar,
.all-products-table-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.all-products-modal-body::-webkit-scrollbar-track,
.all-products-table-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

.all-products-modal-body::-webkit-scrollbar-thumb,
.all-products-table-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.all-products-modal-body::-webkit-scrollbar-thumb:hover,
.all-products-table-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

.all-products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.all-products-table th {
  background: rgba(15, 23, 42, 0.8);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.all-products-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  vertical-align: middle;
}

.all-products-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
}

.badge-rank {
  display: inline-flex;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
}

.badge-rank-first {
  background: linear-gradient(135deg, #fcd34d 0%, #d97706 100%);
  color: #000;
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.3);
}

.badge-rank-second {
  background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
  color: #000;
  box-shadow: 0 0 10px rgba(203, 213, 225, 0.3);
}

.badge-rank-third {
  background: linear-gradient(135deg, #fed7aa 0%, #ca8a04 100%);
  color: #000;
  box-shadow: 0 0 10px rgba(202, 138, 4, 0.3);
}

.badge-rank-other {
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
}

.bed-brand-tag {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-main);
  margin-right: 6px;
}

.all-products-modal-footer {
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.btn-all-products-close {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-all-products-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* ==========================================================================
   HIGH-CONTRAST LIGHT-THEME OVERRIDES FOR MEDICAL REPORT SVG MANNEQUIN
   ========================================================================== */
#print-svg-container {
  background: #fafbfe !important;
  border: 1px solid #cbd5e1 !important;
}

#print-svg-container svg {
  filter: none !important;
  width: auto !important;
  height: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
}

#print-svg-container svg * {
  filter: none !important; /* Strip glowing neon drop shadows */
}

#print-svg-container .body-outline {
  fill: rgba(12, 74, 96, 0.06) !important; /* Soft, premium ice-blue fill */
  stroke: #0c4a60 !important;              /* Rich deep slate/teal contour line */
  stroke-width: 1.8px !important;
}

#print-svg-container .body-joint {
  fill: #ffffff !important;
  stroke: #0284c7 !important;              /* Clean blue dots */
  stroke-width: 1.5px !important;
  r: 3px !important;
}

#print-svg-container .measurement-line {
  stroke: rgba(15, 23, 42, 0.15) !important;
  stroke-width: 1px !important;
}

#print-svg-container .measurement-line.active {
  stroke: #0284c7 !important;              /* Highlight measurement lines in sharp blue */
  stroke-width: 1.5px !important;
}

#print-svg-container .measurement-text {
  font-family: 'Inter', 'Noto Sans TC', system-ui, sans-serif !important;
  fill: #64748b !important;                /* Muted slate text for other labels */
  opacity: 1 !important;                   /* Force visibility */
  text-shadow: none !important;
}

#print-svg-container .measurement-text.active {
  fill: #0f172a !important;                /* High-contrast charcoal/black for active labels */
  font-weight: 700 !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

#print-svg-container .segment-divider {
  stroke: rgba(12, 74, 96, 0.15) !important;
  stroke-width: 1px !important;
}

#print-svg-container .segment-overlay-zone {
  display: none !important;
  opacity: 0 !important;
}

/* Concentric grids and vertical dividing lines inside SVG */
#print-svg-container svg > circle {
  stroke: rgba(15, 23, 42, 0.03) !important;
}

#print-svg-container svg > line {
  stroke: rgba(15, 23, 42, 0.05) !important;
}

/* Biomechanical spine path */
#print-svg-container path:not(.body-outline) {
  stroke: #0d9488 !important;              /* Crisp solid teal spine line */
.all-products-table-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

.all-products-modal-body::-webkit-scrollbar-thumb,
.all-products-table-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.all-products-modal-body::-webkit-scrollbar-thumb:hover,
.all-products-table-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

.all-products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.all-products-table th {
  background: rgba(15, 23, 42, 0.8);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.all-products-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  vertical-align: middle;
}

.all-products-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
}

.badge-rank {
  display: inline-flex;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
}

.badge-rank-first {
  background: linear-gradient(135deg, #fcd34d 0%, #d97706 100%);
  color: #000;
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.3);
}

.badge-rank-second {
  background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
  color: #000;
  box-shadow: 0 0 10px rgba(203, 213, 225, 0.3);
}

.badge-rank-third {
  background: linear-gradient(135deg, #fed7aa 0%, #ca8a04 100%);
  color: #000;
  box-shadow: 0 0 10px rgba(202, 138, 4, 0.3);
}

.badge-rank-other {
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
}

.bed-brand-tag {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-main);
  margin-right: 6px;
}

.all-products-modal-footer {
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.btn-all-products-close {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-all-products-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* ==========================================================================
   HIGH-CONTRAST LIGHT-THEME OVERRIDES FOR MEDICAL REPORT SVG MANNEQUIN
   ========================================================================== */
#print-svg-container {
  background: #fafbfe !important;
  border: 1px solid #cbd5e1 !important;
}

#print-svg-container svg {
  filter: none !important;
  width: auto !important;
  height: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
}

#print-svg-container svg * {
  filter: none !important; /* Strip glowing neon drop shadows */
}

#print-svg-container .body-outline {
  fill: rgba(12, 74, 96, 0.06) !important; /* Soft, premium ice-blue fill */
  stroke: #0c4a60 !important;              /* Rich deep slate/teal contour line */
  stroke-width: 1.8px !important;
}

#print-svg-container .body-joint {
  fill: #ffffff !important;
  stroke: #0284c7 !important;              /* Clean blue dots */
  stroke-width: 1.5px !important;
  r: 3px !important;
}

#print-svg-container .measurement-line {
  stroke: rgba(15, 23, 42, 0.15) !important;
  stroke-width: 1px !important;
}

#print-svg-container .measurement-line.active {
  stroke: #0284c7 !important;              /* Highlight measurement lines in sharp blue */
  stroke-width: 1.5px !important;
}

#print-svg-container .measurement-text {
  font-family: 'Inter', 'Noto Sans TC', system-ui, sans-serif !important;
  fill: #64748b !important;                /* Muted slate text for other labels */
  opacity: 1 !important;                   /* Force visibility */
  text-shadow: none !important;
}

#print-svg-container .measurement-text.active {
  fill: #0f172a !important;                /* High-contrast charcoal/black for active labels */
  font-weight: 700 !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

#print-svg-container .segment-divider {
  stroke: rgba(12, 74, 96, 0.15) !important;
  stroke-width: 1px !important;
}

#print-svg-container .segment-overlay-zone {
  display: none !important;
  opacity: 0 !important;
}

/* Concentric grids and vertical dividing lines inside SVG */
#print-svg-container svg > circle {
  stroke: rgba(15, 23, 42, 0.03) !important;
}

#print-svg-container svg > line {
  stroke: rgba(15, 23, 42, 0.05) !important;
}

/* Biomechanical spine path */
#print-svg-container path:not(.body-outline) {
  stroke: #0d9488 !important;              /* Crisp solid teal spine line */
  stroke-width: 2.5px !important;
  opacity: 0.95 !important;
}

/* Lordosis callout guidelines, text & arrows (neon cyan overrides) */
#print-svg-container [stroke="#00ffcc"] {
  stroke: #0d9488 !important;
}

.all-products-modal-body::-webkit-scrollbar-thumb:hover,
.all-products-table-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

.all-products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.all-products-table th {
  background: rgba(15, 23, 42, 0.8);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.all-products-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  vertical-align: middle;
}

.all-products-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
}

.badge-rank {
  display: inline-flex;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
}

.badge-rank-first {
  background: linear-gradient(135deg, #fcd34d 0%, #d97706 100%);
  color: #000;
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.3);
}

.badge-rank-second {
  background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
  color: #000;
  box-shadow: 0 0 10px rgba(203, 213, 225, 0.3);
}

.badge-rank-third {
  background: linear-gradient(135deg, #fed7aa 0%, #ca8a04 100%);
  color: #000;
  box-shadow: 0 0 10px rgba(202, 138, 4, 0.3);
}

.badge-rank-other {
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
}

.bed-brand-tag {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-main);
  margin-right: 6px;
}

.all-products-modal-footer {
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.btn-all-products-close {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-all-products-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* ==========================================================================
   HIGH-CONTRAST LIGHT-THEME OVERRIDES FOR MEDICAL REPORT SVG MANNEQUIN
   ========================================================================== */
#print-svg-container {
  background: #fafbfe !important;
  border: 1px solid #cbd5e1 !important;
}

#print-svg-container svg {
  filter: none !important;
  width: auto !important;
  height: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
}

#print-svg-container svg * {
  filter: none !important; /* Strip glowing neon drop shadows */
}

#print-svg-container .body-outline {
  fill: rgba(12, 74, 96, 0.06) !important; /* Soft, premium ice-blue fill */
  stroke: #0c4a60 !important;              /* Rich deep slate/teal contour line */
  stroke-width: 1.8px !important;
}

#print-svg-container .body-joint {
  fill: #ffffff !important;
  stroke: #0284c7 !important;              /* Clean blue dots */
  stroke-width: 1.5px !important;
  r: 3px !important;
}

#print-svg-container .measurement-line {
  stroke: rgba(15, 23, 42, 0.15) !important;
  stroke-width: 1px !important;
}

#print-svg-container .measurement-line.active {
  stroke: #0284c7 !important;              /* Highlight measurement lines in sharp blue */
  stroke-width: 1.5px !important;
}

#print-svg-container .measurement-text {
  font-family: 'Inter', 'Noto Sans TC', system-ui, sans-serif !important;
  fill: #64748b !important;                /* Muted slate text for other labels */
  opacity: 1 !important;                   /* Force visibility */
  text-shadow: none !important;
}

#print-svg-container .measurement-text.active {
  fill: #0f172a !important;                /* High-contrast charcoal/black for active labels */
  font-weight: 700 !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

#print-svg-container .segment-divider {
  stroke: rgba(12, 74, 96, 0.15) !important;
  stroke-width: 1px !important;
}

#print-svg-container .segment-overlay-zone {
  display: none !important;
  opacity: 0 !important;
}

/* Concentric grids and vertical dividing lines inside SVG */
#print-svg-container svg > circle {
  stroke: rgba(15, 23, 42, 0.03) !important;
}

#print-svg-container svg > line {
  stroke: rgba(15, 23, 42, 0.05) !important;
}

/* Biomechanical spine path */
#print-svg-container path:not(.body-outline) {
  stroke: #0d9488 !important;              /* Crisp solid teal spine line */
  stroke-width: 2.5px !important;
  opacity: 0.95 !important;
}

/* Lordosis callout guidelines, text & arrows (neon cyan overrides) */
#print-svg-container [stroke="#00ffcc"] {
  stroke: #0d9488 !important;
}

#print-svg-container [fill="#00ffcc"] {
  fill: #0d9488 !important;
}

#print-svg-container [fill="rgba(255,255,255,0.4)"] {
  fill: #64748b !important;                /* Legible soft labels at the bottom */
}

/* --- V1.6.8 3D AESTHETIC PILLOW PREMIUM CUSTOM CARD STYLES --- */
@media (max-width: 768px) {
  .pillow-3d-premium-card {
    flex-direction: column !important;
    text-align: center;
    padding: 16px !important;
  }
  .pillow-3d-premium-card ul {
    text-align: left;
    display: inline-block;
  }
  .pillow-3d-premium-card .btn-accent {
    width: 100%;
    justify-content: center;
  }
}
