/* ==========================================================================
   Fatty Liver Detection System - Professional Medical AI Dashboard CSS
   Inspired by Modern Healthcare Clinical Software (Reference 1)
   ========================================================================== */

:root {
  /* Color Palette - Light Medical Theme (Default) */
  --bg-app: #f4f7fb;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f8fafc;
  --bg-sidebar: #ffffff;
  
  --primary: #2478f3;
  --primary-hover: #1a68dd;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --primary-glow: rgba(36, 120, 243, 0.15);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-heading: #1e293b;
  
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  
  /* Class Colors */
  --color-normal: #10b981;
  --color-normal-bg: #ecfdf5;
  --color-normal-border: #a7f3d0;
  
  --color-grade1: #2563eb;
  --color-grade1-bg: #eff6ff;
  --color-grade1-border: #bfdbfe;
  
  --color-grade2: #f59e0b;
  --color-grade2-bg: #fffbeb;
  --color-grade2-border: #fde68a;
  
  --color-grade3: #ef4444;
  --color-grade3-bg: #fef2f2;
  --color-grade3-border: #fecaca;
  
  --color-cld: #8b5cf6;
  --color-cld-bg: #f5f3ff;
  --color-cld-border: #ddd6fe;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --sidebar-width: 260px;
  --topbar-height: 70px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Support */
[data-theme="dark"] {
  --bg-app: #0b1120;
  --bg-surface: #131c2e;
  --bg-surface-subtle: #1e293b;
  --bg-sidebar: #0f172a;
  
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.15);
  --primary-border: rgba(59, 130, 246, 0.3);
  --primary-glow: rgba(59, 130, 246, 0.25);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --text-heading: #ffffff;
  
  --border-color: #1e293b;
  --border-subtle: #1a2333;
  
  --color-normal-bg: rgba(16, 185, 129, 0.12);
  --color-grade1-bg: rgba(37, 99, 235, 0.12);
  --color-grade2-bg: rgba(245, 158, 11, 0.12);
  --color-grade3-bg: rgba(239, 68, 68, 0.12);
  --color-cld-bg: rgba(139, 92, 246, 0.12);
  
  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* CSS Reset & Global */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* App Wrapper Layout */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ==========================================================================
   A. Left Sidebar Navigation
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: auto;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.sidebar-close-btn:hover {
  color: var(--text-heading);
  background: var(--bg-surface-subtle);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.sidebar-drawer-open {
  overflow: hidden;
}

.brand-logo-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-logo-wrap img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
}

.brand-text h1 span {
  display: block;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.brand-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
}

.sidebar-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.925rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: var(--transition);
  flex-shrink: 0;
}

.nav-item:hover {
  background-color: var(--bg-surface-subtle);
  color: var(--text-heading);
}

.nav-item.active {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(36, 120, 243, 0.25);
  font-weight: 600;
}

.nav-item.active svg {
  stroke: #ffffff;
}

.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid var(--border-subtle);
}

.system-status-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background-color: var(--color-normal);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.status-info {
  font-size: 0.75rem;
  line-height: 1.2;
}

.status-info strong {
  display: block;
  color: var(--text-heading);
  font-weight: 600;
}

.status-info span {
  color: var(--text-muted);
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Navigation Bar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(8px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  padding: 6px;
  cursor: pointer;
}

.breadcrumbs {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.breadcrumbs strong {
  color: var(--text-heading);
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.model-badge-top {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-normal-bg);
  border: 1px solid var(--color-normal-border);
  color: var(--color-normal);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.785rem;
  font-weight: 600;
}

.icon-btn {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* Page Container */
.content-area {
  padding: 28px 32px 48px;
  flex: 1;
}

/* View Sections */
.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* ==========================================================================
   C. Medical Hero Banner (Reference 1)
   ========================================================================== */
.medical-hero {
  background: linear-gradient(135deg, #e7f0fa 0%, #edf5ff 55%, #e0effe 100%);
  border: 1px solid #d0e3fc;
  border-radius: var(--radius-xl);
  padding: 32px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px -2px rgba(36, 120, 243, 0.08);
}

[data-theme="dark"] .medical-hero {
  background: linear-gradient(135deg, #0e1e38 0%, #112649 55%, #0f2240 100%);
  border-color: #1e3a66;
}

.hero-content {
  max-width: 620px;
  z-index: 2;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: var(--primary);
  border: 1px solid var(--primary-border);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 9999px;
  margin-bottom: 12px;
  box-shadow: 0 2px 4px rgba(36, 120, 243, 0.06);
}

[data-theme="dark"] .hero-pill {
  background: rgba(36, 120, 243, 0.2);
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  color: #0f254e;
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

[data-theme="dark"] .hero-title {
  color: #f1f5f9;
}

.hero-subtitle {
  font-size: 1rem;
  color: #334e68;
  line-height: 1.5;
  margin-bottom: 18px;
}

[data-theme="dark"] .hero-subtitle {
  color: #94a3b8;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-tag {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(191, 219, 254, 0.8);
  color: #1e3a8a;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.775rem;
  font-weight: 500;
}

[data-theme="dark"] .hero-tag {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.hero-illustration {
  width: 280px;
  height: 170px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.8);
  flex-shrink: 0;
  position: relative;
}

.hero-illustration img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s ease;
}

.hero-illustration:hover img {
  transform: scale(1.04);
}

/* ==========================================================================
   4. Feature Summary Cards (Reference 1)
   ========================================================================== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
}

.feature-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.feature-icon-badge svg {
  width: 22px;
  height: 22px;
}

.feature-card.purple .feature-icon-badge {
  background: #f3e8ff;
  color: #9333ea;
}
.feature-card.green .feature-icon-badge {
  background: #dcfce7;
  color: #16a34a;
}
.feature-card.blue .feature-icon-badge {
  background: #dbeafe;
  color: #2563eb;
}
.feature-card.amber .feature-icon-badge {
  background: #fef3c7;
  color: #d97706;
}

[data-theme="dark"] .feature-card.purple .feature-icon-badge { background: rgba(147, 51, 234, 0.2); color: #c084fc; }
[data-theme="dark"] .feature-card.green .feature-icon-badge { background: rgba(22, 163, 74, 0.2); color: #4ade80; }
[data-theme="dark"] .feature-card.blue .feature-icon-badge { background: rgba(37, 99, 235, 0.2); color: #60a5fa; }
[data-theme="dark"] .feature-card.amber .feature-icon-badge { background: rgba(217, 119, 6, 0.2); color: #fbbf24; }

.feature-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.feature-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   5 & 6. Two-Column Workspace: Upload & Sample Image
   ========================================================================== */
.analysis-workspace {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.dashboard-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title-icon {
  color: var(--primary);
  display: flex;
  align-items: center;
}

.card-title-icon svg {
  width: 22px;
  height: 22px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-heading);
}

/* Mode Switcher Tabs */
.mode-toggle-group {
  display: flex;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.mode-tab-btn {
  padding: 5px 12px;
  font-size: 0.775rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.mode-tab-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Upload Dropzone */
.dropzone {
  border: 2px dashed #93c5fd;
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  background: #fbfdff;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

[data-theme="dark"] .dropzone {
  background: #0f182a;
  border-color: #2563eb;
}

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

.dropzone-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  color: #3b82f6;
  opacity: 0.9;
}

.dropzone-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 1.75;
}

.dropzone-title {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.dropzone-divider {
  font-size: 0.8rem;
  color: var(--text-light);
  margin: 6px 0;
}

.btn-browse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(36, 120, 243, 0.25);
  margin-top: 4px;
}

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

.dropzone-hint {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 12px;
}

/* Upload Image Preview State */
.preview-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.preview-img-container {
  max-height: 240px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.preview-img-container img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.file-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-heading);
  font-weight: 500;
}

.file-dims {
  color: var(--text-muted);
}

.btn-actions-row {
  display: flex;
  gap: 12px;
}

.btn-primary {
  flex: 1;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(36, 120, 243, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--border-subtle);
  color: var(--text-heading);
}

/* Sample Ultrasound Image Card */
.sample-card-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sample-selector-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sample-pill {
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
  border-radius: 9999px;
  cursor: pointer;
  transition: var(--transition);
}

.sample-pill:hover {
  border-color: var(--primary-border);
  color: var(--primary);
}

.sample-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.sample-image-frame {
  height: 200px;
  background: #000000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.sample-image-frame img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
}

.sample-badge-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.sample-description {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.4;
  min-height: 38px;
}

/* ==========================================================================
   7. Predicted Class Probabilities & Results Section (Reference 1)
   ========================================================================== */
.results-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-card);
  margin-bottom: 28px;
}

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

/* Highlighted Prediction Banner (shown after analysis) */
.prediction-summary-banner {
  display: none;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 24px;
  animation: slideDown 0.3s ease;
}

.prediction-summary-banner.show {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.summary-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
}

.diagnosis-badge-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.diagnosis-class-badge {
  font-size: 1.25rem;
  font-weight: 800;
  padding: 6px 18px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.severity-pill {
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.severity-pill.normal {
  background: var(--color-normal-bg);
  color: var(--color-normal);
  border: 1px solid var(--color-normal-border);
}

.severity-pill.abnormal {
  background: var(--color-grade3-bg);
  color: var(--color-grade3);
  border: 1px solid var(--color-grade3-border);
}

.summary-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.summary-meta span strong {
  color: var(--text-heading);
}

.diagnosis-desc {
  font-size: 0.925rem;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 14px;
}

.summary-actions-row {
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

/* 5 Probability Cards Grid (Exact Reference 1 Layout) */
.prob-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.prob-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .prob-card {
  background: var(--bg-surface);
}

.prob-card.card-normal { background: var(--color-normal-bg); border-color: var(--color-normal-border); }
.prob-card.card-grade1 { background: var(--color-grade1-bg); border-color: var(--color-grade1-border); }
.prob-card.card-grade2 { background: var(--color-grade2-bg); border-color: var(--color-grade2-border); }
.prob-card.card-grade3 { background: var(--color-grade3-bg); border-color: var(--color-grade3-border); }
.prob-card.card-cld    { background: var(--color-cld-bg);    border-color: var(--color-cld-border); }

.prob-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-normal .prob-card-title { color: var(--color-normal); }
.card-grade1 .prob-card-title { color: var(--color-grade1); }
.card-grade2 .prob-card-title { color: var(--color-grade2); }
.card-grade3 .prob-card-title { color: var(--color-grade3); }
.card-cld    .prob-card-title { color: var(--color-cld); }

.prob-card-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.prob-card-pct {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.card-normal .prob-card-pct { color: var(--color-normal); }
.card-grade1 .prob-card-pct { color: var(--color-grade1); }
.card-grade2 .prob-card-pct { color: var(--color-grade2); }
.card-grade3 .prob-card-pct { color: var(--color-grade3); }
.card-cld    .prob-card-pct { color: var(--color-cld); }

/* Progress Bar */
.prob-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: auto;
}

[data-theme="dark"] .prob-bar-track {
  background: rgba(255, 255, 255, 0.1);
}

.prob-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 9999px;
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-normal .prob-bar-fill { background-color: var(--color-normal); }
.card-grade1 .prob-bar-fill { background-color: var(--color-grade1); }
.card-grade2 .prob-bar-fill { background-color: var(--color-grade2); }
.card-grade3 .prob-bar-fill { background-color: var(--color-grade3); }
.card-cld    .prob-bar-fill { background-color: var(--color-cld); }

/* Winner Highlighting */
.prob-card.predicted-winner {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px -2px rgba(36, 120, 243, 0.18);
  border-width: 2px;
}

.winner-badge {
  display: none;
  position: absolute;
  top: -9px;
  right: 10px;
  background: #0f172a;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.prob-card.predicted-winner .winner-badge {
  display: block;
}

/* Clinical Disclaimer Note */
.disclaimer-card {
  margin-top: 24px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-grade2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.disclaimer-icon {
  color: var(--color-grade2);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ==========================================================================
   8. Prediction History Section
   ========================================================================== */
.history-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.search-input-wrap {
  position: relative;
  min-width: 280px;
}

.search-input-wrap input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
}

.search-icon-pos {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 16px;
  height: 16px;
}

.filter-select {
  padding: 8px 14px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
}

.history-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

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

.history-table th {
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.history-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.history-table tr:hover {
  background: var(--bg-surface-subtle);
}

.empty-history-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}

/* ==========================================================================
   9. Model Information Section
   ========================================================================== */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.spec-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.spec-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.875rem;
}

.spec-label {
  color: var(--text-muted);
  font-weight: 500;
}

.spec-value {
  color: var(--text-heading);
  font-weight: 600;
  text-align: right;
}

/* ==========================================================================
   10. About Section
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.about-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.about-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 12px;
}

.about-card p {
  color: var(--text-muted);
  font-size: 0.925rem;
  line-height: 1.6;
  margin-bottom: 16px;
}

/* Loading & Toast States */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.loading-box {
  background: var(--bg-surface);
  padding: 28px 36px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  text-align: center;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition);
  z-index: 1001;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: #b91c1c;
}

/* ==========================================================================
   Responsive Breakpoints & Mobile Optimization
   ========================================================================== */
@media (max-width: 1200px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .analysis-workspace {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .prob-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 992px) {
  .acoustic-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 280px;
    max-width: 84vw;
    z-index: 1000;
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.22);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .main-wrapper {
    margin-left: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .medical-hero {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  .hero-illustration {
    width: 100%;
    max-width: 360px;
    height: 180px;
  }
  .hero-tags {
    justify-content: center;
  }
  .prob-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .spec-grid {
    grid-template-columns: 1fr;
  }
  .about-grid {
    grid-template-columns: 1fr;
  }
  .settings-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 16px;
    height: 60px;
  }
  .topbar-left {
    gap: 12px;
  }
  .topbar-right {
    gap: 10px;
  }
  .user-info-text {
    display: none;
  }
  .user-profile-badge {
    padding: 4px 6px;
    gap: 6px;
  }
  .model-badge-top {
    padding: 4px 10px;
    font-size: 0.72rem;
  }
  .history-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .search-input-wrap {
    min-width: 100%;
    width: 100%;
  }
  .filter-select {
    width: 100%;
  }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .card-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }
  .card-actions button {
    flex: 1;
    justify-content: center;
  }
  .patient-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .a4-modal-overlay {
    padding: 0;
  }
  .a4-modal-dialog {
    width: 100%;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  .a4-modal-toolbar {
    padding: 0 12px;
    height: 52px;
  }
  .a4-format-badge {
    display: none;
  }
  .a4-toolbar-actions {
    gap: 6px;
  }
  .btn-a4-print,
  .btn-a4-download {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  .a4-document-viewport {
    padding: 12px 6px 36px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }
  .a4-report-sheet {
    margin: 0 auto;
  }
}

@media (max-width: 600px) {
  .content-area {
    padding: 16px 12px 40px;
  }
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .prob-cards-grid {
    grid-template-columns: 1fr;
  }
  .medical-hero {
    padding: 20px 16px;
  }
  .hero-title {
    font-size: 1.35rem;
    letter-spacing: -0.3px;
  }
  .hero-subtitle {
    font-size: 0.875rem;
  }
  .patient-meta-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .acoustic-metrics-grid {
    grid-template-columns: 1fr;
  }
  .graph-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .graph-tabs {
    width: 100%;
    flex-direction: column;
  }
  .graph-tab-btn {
    width: 100%;
    justify-content: center;
  }
  .dropzone {
    padding: 24px 14px;
  }
  .dropzone-title {
    font-size: 0.95rem;
  }
  .btn-browse {
    width: 100%;
    max-width: 220px;
    justify-content: center;
  }
  .mode-toggle-group {
    width: 100%;
    margin-top: 6px;
  }
  .mode-tab-btn {
    flex: 1;
    text-align: center;
    justify-content: center;
  }
  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .settings-input,
  .range-slider-wrapper {
    width: 100%;
    min-width: 0;
  }
  .settings-actions-bar {
    flex-direction: column;
    gap: 10px;
  }
  .settings-actions-bar button {
    width: 100%;
    justify-content: center;
  }
  /* Prevent iOS Safari 16px auto-zoom */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  select {
    font-size: 16px !important;
  }
}

@media (max-width: 500px) {
  .breadcrumbs {
    display: none;
  }
  .model-badge-top span#topbarStatusText {
    display: none;
  }
  .model-badge-top {
    padding: 6px;
    border-radius: 50%;
  }
  .model-badge-top .pulse-dot {
    margin: 0;
  }
  #helpBtn {
    display: none;
  }
}

/* ==========================================================================
   Analytics Graph Card & Clinical Charts (Top-Level)
   ========================================================================== */
.analytics-graph-card {
  margin-top: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 30px 32px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(36, 120, 243, 0.04);
  position: relative;
  overflow: hidden;
}

.analytics-graph-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2478f3, #06b6d4, #10b981);
}

.graph-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.analytics-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.analytics-badge {
  background: rgba(36, 120, 243, 0.1);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

[data-theme="dark"] .analytics-badge {
  background: rgba(36, 120, 243, 0.2);
  color: #60a5fa;
}

.analytics-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.graph-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  padding: 6px;
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.graph-tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.graph-tab-btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
  transition: transform 0.2s ease;
}

.graph-tab-btn:hover {
  color: var(--text-heading);
  background: rgba(36, 120, 243, 0.06);
}

.graph-tab-btn:hover svg {
  transform: translateY(-1px);
}

[data-theme="dark"] .graph-tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.graph-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(36, 120, 243, 0.35);
}

.graph-tab-btn.active svg {
  stroke: #ffffff;
}

.acoustic-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.metric-chip {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.metric-chip::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  transition: background 0.2s ease;
}

.metric-chip.chip-blue::before { background: #2563eb; }
.metric-chip.chip-amber::before { background: #f59e0b; }
.metric-chip.chip-purple::before { background: #8b5cf6; }
.metric-chip.chip-emerald::before { background: #10b981; }

.metric-chip:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  border-color: var(--primary-border);
}

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

.metric-chip-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-blue .metric-chip-icon { background: #dbeafe; color: #1d4ed8; }
.chip-amber .metric-chip-icon { background: #fef3c7; color: #b45309; }
.chip-purple .metric-chip-icon { background: #ede9fe; color: #6d28d9; }
.chip-emerald .metric-chip-icon { background: #d1fae5; color: #047857; }

[data-theme="dark"] .chip-blue .metric-chip-icon { background: rgba(37, 99, 235, 0.25); color: #93c5fd; }
[data-theme="dark"] .chip-amber .metric-chip-icon { background: rgba(245, 158, 11, 0.25); color: #fde68a; }
[data-theme="dark"] .chip-purple .metric-chip-icon { background: rgba(139, 92, 246, 0.25); color: #ddd6fe; }
[data-theme="dark"] .chip-emerald .metric-chip-icon { background: rgba(16, 185, 129, 0.25); color: #a7f3d0; }

.metric-chip-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-chip-value-row {
  margin-bottom: 6px;
}

.metric-chip-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.2;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.metric-chip-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green { background: #10b981; box-shadow: 0 0 6px #10b981; }
.status-dot.amber { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }
.status-dot.purple { background: #8b5cf6; box-shadow: 0 0 6px #8b5cf6; }
.status-dot.blue { background: #2563eb; box-shadow: 0 0 6px #2563eb; }

.metric-chip-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.graph-viewport-wrap {
  position: relative;
  min-height: 380px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-container {
  display: none;
  width: 100%;
  height: 360px;
  position: relative;
}

.chart-container.active {
  display: block;
}

@media (max-width: 1024px) {
  .acoustic-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .acoustic-metrics-grid {
    grid-template-columns: 1fr;
  }
  .graph-card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .graph-tabs {
    width: 100%;
  }
  .graph-tab-btn {
    flex: 1;
    justify-content: center;
    font-size: 0.75rem;
    padding: 6px 10px;
  }
}

/* Print Stylesheet for Medical Report */
@media print {
  .sidebar, .topbar, .btn-actions-row, .sample-selector-pills, .btn-browse, .history-controls {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  body {
    background: #ffffff !important;
  }
  .dashboard-card, .results-section {
    border: 1px solid #000 !important;
    box-shadow: none !important;
  }
}

/* ==========================================================================
   Modern Medical Authentication Portal (Supabase Powered)
   ========================================================================== */
.auth-overlay-portal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(ellipse at 50% 25%, rgba(36, 120, 243, 0.22), rgba(15, 23, 42, 0.95) 70%), #070e1b;
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.auth-overlay-portal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card-wrapper {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  width: 100%;
  max-width: 1020px;
  min-height: 620px;
  background: #ffffff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 80px -15px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.15);
  transition: transform 0.35s ease;
}

[data-theme="dark"] .auth-card-wrapper {
  background: #0f172a;
  box-shadow: 0 30px 80px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Left Brand Showcase Panel */
.auth-brand-panel {
  background: linear-gradient(150deg, #091b36 0%, #122f5c 50%, #0a1933 100%);
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  color: #ffffff;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-brand-panel::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(36, 120, 243, 0.25), transparent 45%);
  pointer-events: none;
}

.auth-brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}

.auth-brand-badge {
  background: rgba(36, 120, 243, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.4);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 4px 12px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.auth-brand-center {
  margin: auto 0;
  z-index: 2;
}

.auth-liver-showcase {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 190px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 24px;
}

.auth-liver-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.auth-liver-showcase:hover .auth-liver-img {
  transform: scale(1.05);
}

.pulse-scanline {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #38bdf8, #60a5fa, transparent);
  box-shadow: 0 0 12px #38bdf8;
  animation: scanlineMove 3s ease-in-out infinite alternate;
}

@keyframes scanlineMove {
  0% { top: 5%; opacity: 0.4; }
  50% { opacity: 1; }
  100% { top: 92%; opacity: 0.4; }
}

.auth-hero-title {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 10px;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.auth-hero-title span {
  color: #60a5fa;
}

.auth-hero-subtitle {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 22px;
  max-width: 440px;
}

.auth-feature-pills {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
  width: fit-content;
}

.auth-pill svg {
  stroke: #38bdf8;
}

.auth-brand-footer {
  font-size: 0.725rem;
  color: #94a3b8;
  z-index: 2;
}

/* Right Interactive Form Panel */
.auth-form-panel {
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-surface);
}

.auth-form-header {
  margin-bottom: 22px;
}

.auth-heading {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}

.auth-subheading {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-segmented-tabs {
  display: flex;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 22px;
}

.auth-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(36, 120, 243, 0.3);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.auth-form.active {
  display: flex;
}

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

.form-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-heading);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon svg {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-icon input,
.input-with-icon textarea {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-heading);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-with-icon input:focus,
.input-with-icon textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36, 120, 243, 0.15);
}

.btn-toggle-pwd {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.btn-toggle-pwd:hover {
  color: var(--text-heading);
}

.btn-auth-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #2478f3 0%, #1d4ed8 100%);
  color: #ffffff;
  border: none;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(36, 120, 243, 0.35);
  transition: all 0.25s ease;
  margin-top: 6px;
}

.btn-auth-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(36, 120, 243, 0.45);
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0;
  color: var(--text-light);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}

.auth-divider span {
  padding: 0 12px;
}

.btn-demo-access {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 11px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

[data-theme="dark"] .btn-demo-access {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.btn-demo-access:hover {
  background: #f59e0b;
  color: #ffffff;
  border-color: #f59e0b;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.auth-supabase-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 14px;
}

.supabase-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.supabase-status-pill .status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.supabase-status-pill.connected .status-indicator-dot {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.btn-config-supabase {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-heading);
  font-size: 0.725rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-config-supabase:hover {
  background: var(--bg-surface-subtle);
  border-color: var(--primary-border);
}

/* Clinician Profile Badge in Topbar */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  padding: 5px 12px 5px 6px;
  border-radius: 9999px;
  margin-left: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2478f3, #06b6d4);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-heading);
}

.user-role {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

.btn-logout:hover {
  color: #ef4444;
}

/* Supabase Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(36, 120, 243, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
}

.modal-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

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

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

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-help {
  font-size: 0.7rem;
  color: var(--text-light);
}

.modal-feedback {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
}

.modal-feedback.success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.modal-feedback.error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

@media (max-width: 860px) {
  .auth-card-wrapper {
    grid-template-columns: 1fr;
    max-width: 520px;
  }
  .auth-brand-panel {
    display: none;
  }
  .user-info-text {
    display: none;
  }
}

/* ==========================================================================
   Dashboard KPI & Quick Scan Launcher Styles
   ========================================================================== */
.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .dashboard-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-icon-pill {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-pill.blue {
  background: rgba(36, 120, 243, 0.12);
  color: var(--primary);
}

.kpi-icon-pill.green {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.kpi-icon-pill.purple {
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
}

.kpi-icon-pill.amber {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 2px;
}

.dashboard-action-banner {
  background: linear-gradient(135deg, rgba(36, 120, 243, 0.08) 0%, rgba(59, 130, 246, 0.03) 100%);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .dashboard-action-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

.action-banner-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 6px;
}

.action-banner-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.5;
}

.action-banner-btns {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ==========================================================================
   Workstation Patient Metadata Grid
   ========================================================================== */
.patient-meta-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
}

.patient-meta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.patient-meta-header h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.patient-meta-header span {
  font-size: 0.75rem;
  color: var(--text-light);
}

.patient-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 1.5fr;
  gap: 14px;
}

@media (max-width: 1024px) {
  .patient-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .patient-meta-grid {
    grid-template-columns: 1fr;
  }
}

.meta-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.meta-field input {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.85rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  transition: border-color 0.2s;
}

.meta-field input:focus {
  border-color: var(--primary);
  outline: none;
}

/* ==========================================================================
   Settings View Interactive Styles
   ========================================================================== */
.settings-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .settings-container {
    grid-template-columns: 1fr;
  }
}

.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
}

.settings-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-info {
  flex: 1;
}

.settings-row-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.settings-row-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-input {
  padding: 8px 12px;
  font-size: 0.85rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  min-width: 180px;
}

.settings-input:focus {
  border-color: var(--primary);
  outline: none;
}

/* Range Slider */
.range-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-slider {
  accent-color: var(--primary);
  cursor: pointer;
}

.range-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  min-width: 44px;
  text-align: center;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

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

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

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

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

.settings-actions-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 16px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* ==========================================================================
   A4 Medical Report Modal & Document Viewport Layout
   ========================================================================== */
.a4-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10005;
  background: rgba(11, 19, 41, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.a4-modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.a4-modal-dialog {
  width: 100%;
  max-width: 980px;
  height: 94vh;
  max-height: 940px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.a4-modal-overlay.show .a4-modal-dialog {
  transform: scale(1);
}

.a4-modal-toolbar {
  flex-shrink: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #090e1a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  z-index: 5;
}

.a4-toolbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #f8fafc;
}

.a4-format-badge {
  font-size: 0.68rem;
  background: rgba(36, 120, 243, 0.25);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.a4-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-a4-print {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-a4-print:hover {
  background: #1d4ed8;
}

.btn-a4-download {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-a4-download:hover {
  background: #334155;
  border-color: #475569;
}

.btn-a4-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.btn-a4-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* Document canvas / viewport */
.a4-document-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: #1e293b;
  padding: 24px 16px 40px 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  box-sizing: border-box;
  width: 100%;
}

/* Authentic ISO A4 Sheet Representation (210mm x 297mm) */
.a4-report-sheet {
  width: 210mm;
  max-width: 100%;
  min-height: 297mm;
  height: auto;
  flex-shrink: 0;
  padding: 9mm 13mm;
  background: #ffffff !important;
  color: #0f172a !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  border-radius: 4px;
  margin: 0 auto;
  position: relative;
  overflow: visible;
  line-height: 1.32;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.report-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.report-logo-img {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
}

.report-facility-name {
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.report-department-name {
  font-size: 0.68rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.report-meta-box {
  text-align: right;
  font-size: 0.68rem;
  color: #475569;
  line-height: 1.25;
}

.report-id-badge {
  display: inline-block;
  background: #0f172a;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 3px;
  margin-bottom: 3px;
  letter-spacing: 0.05em;
}

.report-doc-title {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 900;
  color: #1e3a8a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 5px 0 7px 0;
  padding: 4px;
  background: #eff6ff;
  border-radius: 4px;
  border: 1px solid #bfdbfe;
}

.report-patient-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 7px;
  font-size: 0.72rem;
}

.report-patient-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-align: left;
  padding: 3.5px 7px;
  border: 1px solid #cbd5e1;
  width: 16%;
}

.report-patient-table td {
  padding: 3.5px 7px;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  font-weight: 500;
}

.report-diagnosis-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  margin-bottom: 7px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 7px 10px;
}

.report-scan-box {
  width: 140px;
  height: 105px;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.report-scan-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.report-primary-finding {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.report-finding-badge {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 900;
  padding: 3px 12px;
  border-radius: 5px;
  color: #ffffff;
  margin-bottom: 3px;
  width: fit-content;
}

.report-finding-badge.normal { background: #059669; }
.report-finding-badge.grade1 { background: #2563eb; }
.report-finding-badge.grade2 { background: #d97706; }
.report-finding-badge.grade3 { background: #dc2626; }
.report-finding-badge.cld { background: #7c3aed; }

.report-metrics-row {
  display: flex;
  gap: 14px;
  font-size: 0.72rem;
  margin: 3px 0;
  color: #334155;
}

.report-metrics-row strong {
  color: #0f172a;
}

.report-impression-text {
  font-size: 0.71rem;
  line-height: 1.32;
  color: #334155;
  margin-top: 2px;
}

.report-section-heading {
  font-size: 0.76rem;
  font-weight: 800;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 2px;
  margin: 7px 0 4px 0;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.69rem;
  margin-bottom: 7px;
}

.report-table th {
  background: #f1f5f9;
  font-weight: 700;
  color: #1e293b;
  padding: 3.5px 6px;
  border: 1px solid #cbd5e1;
  text-align: left;
}

.report-table td {
  padding: 3px 6px;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.report-table tr.winner-row {
  background: #eff6ff;
  font-weight: 700;
}

.report-table tr.winner-row td {
  color: #1e3a8a;
}

.report-prob-track {
  width: 70px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
}

.report-prob-bar {
  height: 100%;
  background: #2563eb;
  border-radius: 3px;
}

.report-recommendations-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 0.70rem;
  color: #334155;
  line-height: 1.35;
  margin-bottom: 7px;
}

.report-recommendations-box ol {
  margin: 2px 0 0 16px;
  padding: 0;
}

.report-recommendations-box li {
  margin-bottom: 1.5px;
}

.report-signatures {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #cbd5e1;
}

.report-qr-stamp {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-box {
  width: 38px;
  height: 38px;
  border: 1px solid #94a3b8;
  padding: 2px;
  border-radius: 4px;
  background: #fff;
}

.qr-box svg {
  width: 100%;
  height: 100%;
}

.qr-stamp-text {
  font-size: 0.62rem;
  color: #64748b;
  line-height: 1.25;
}

.report-doctor-sig {
  text-align: right;
}

.doctor-sig-line {
  width: 160px;
  border-bottom: 1px solid #0f172a;
  margin-bottom: 3px;
  margin-left: auto;
}

.doctor-sig-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
}

.doctor-sig-role {
  font-size: 0.65rem;
  color: #64748b;
}

.report-footer-notice {
  font-size: 0.60rem;
  color: #94a3b8;
  text-align: center;
  margin-top: 6px;
  border-top: 1px dashed #e2e8f0;
  padding-top: 3px;
}

/* ==========================================================================
   PRINT STYLES FOR A4 MEDICAL REPORT
   ========================================================================== */
@media print {
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* Hide app navigation and all other views */
  .sidebar,
  .topbar,
  .view-section,
  .auth-overlay-portal,
  .modal-backdrop,
  .loading-overlay,
  .toast,
  .a4-modal-toolbar,
  .a4-document-viewport::-webkit-scrollbar {
    display: none !important;
  }

  .main-wrapper,
  .content-area,
  .app-container {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .a4-modal-overlay {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .a4-modal-dialog {
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    transform: none !important;
  }

  .a4-document-viewport {
    background: transparent !important;
    padding: 0 !important;
    overflow: visible !important;
    display: block !important;
  }

  .a4-report-sheet {
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 6mm 8mm !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  @page {
    size: A4 portrait;
    margin: 6mm 8mm;
  }
}

