/* PRYSMIA CARE · Clinical Product Concept Preview Styles */
:root {
  --navy: #000c18;
  --navy-deep: #00060f;
  --blue: #608dff;
  --blue-deep: #204ec2;
  --lime: #f9ff2d;
  --ink: #092034;
  --muted: #536a7c;
  --paper: #f7f9fb;
  --card: #ffffff;
  --line: #dbe4ec;
  --line-dark: rgba(255, 255, 255, 0.12);
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --risk-high: #dc2626;
  --risk-high-bg: #fef2f2;
  --risk-high-border: #fecaca;
  --risk-mid: #d97706;
  --risk-mid-bg: #fffbeb;
  --risk-mid-border: #fde68a;
  --risk-low: #059669;
  --risk-low-bg: #ecfdf5;
  --risk-low-border: #a7f3d0;
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

/* Header */
.app-header {
  background: var(--navy);
  color: #fff;
  border-bottom: 1px solid var(--line-dark);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  height: 40px;
  width: auto;
  display: block;
}

.demo-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(96, 141, 255, 0.15);
  border: 1px solid rgba(96, 141, 255, 0.4);
  color: #c9dbff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.demo-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  animation: pulse 2s infinite;
}

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

/* Nav Tabs */
.nav-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--line-dark);
}

.tab-btn {
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #c8d7e8;
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.tab-btn.active {
  background: var(--blue-deep);
  color: #fff;
  box-shadow: 0 2px 8px rgba(32, 78, 194, 0.4);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang-switch {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  overflow: hidden;
}

.lang-btn {
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #a8bed4;
  transition: all 0.15s ease;
}

.lang-btn.active {
  background: var(--lime);
  color: var(--navy);
}

/* Main Container */
.main-wrapper {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}

/* Notice Banner */
.disclaimer-banner {
  background: #f0f4f9;
  border: 1px solid #d3e0ec;
  border-left: 4px solid var(--blue-deep);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 24px;
}

.disclaimer-text {
  font-size: 0.82rem;
  color: var(--navy);
  font-weight: 700;
  letter-spacing: 0.03em;
}

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

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

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

/* Section Header */
.section-intro {
  margin-bottom: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--blue-deep);
  margin-bottom: 6px;
}

.eyebrow::before {
  content: '';
  width: 14px;
  height: 2px;
  background: var(--blue);
}

.section-intro h2 {
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 8px;
}

.section-intro p {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 820px;
}

/* Layout Grids */
.individual-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 28px;
  align-items: start;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 12, 24, 0.03);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Patient Profile Header Card */
.patient-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.patient-id-tag {
  background: var(--navy);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 4px;
}

.patient-site-tag {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.patient-name-large {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 4px;
}

.patient-subdetail {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.profile-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

.meta-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

.meta-value {
  font-size: 0.85rem;
  color: var(--navy);
  font-weight: 700;
}

/* Timeline Stepper */
.stepper-container {
  margin-top: 20px;
  background: #f1f5fa;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
}

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

.stepper-label {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue-deep);
}

.stepper-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  position: relative;
}

.step-node {
  padding: 12px 10px;
  background: #fff;
  border: 2px solid #ccd8e6;
  border-radius: 8px;
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.step-node:hover {
  border-color: var(--blue-deep);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 12, 24, 0.08);
}

.step-node.active {
  border-color: var(--blue-deep);
  background: #eef4ff;
  box-shadow: 0 3px 8px rgba(32, 78, 194, 0.22);
}

.step-node.active .step-day {
  color: var(--blue-deep);
}

.step-day {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--navy);
  display: block;
}

.step-caption {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
  display: block;
}

.stepper-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn-step {
  flex: 1;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-step.primary {
  background: var(--navy);
  color: #fff;
}

.btn-step.primary:hover {
  background: #0d2844;
}

.btn-step.secondary {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
}

.btn-step.secondary:hover {
  background: #f7f9fb;
}

/* Portrait Stage */
.portrait-container {
  margin-top: 20px;
  position: relative;
}

.portrait-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: #000c18;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

.portrait-overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.portrait-overlay-canvas.active {
  opacity: 1;
}

.portrait-badge-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 12, 24, 0.75);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 700;
}

.portrait-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.toggle-switch-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy);
}

.toggle-switch-input {
  display: none;
}

.toggle-switch-track {
  width: 32px;
  height: 18px;
  background: #cbd5e1;
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
}

.toggle-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch-input:checked + .toggle-switch-track {
  background: var(--blue-deep);
}

.toggle-switch-input:checked + .toggle-switch-track::after {
  transform: translateX(14px);
}

/* Local Upload Area */
.local-upload-box {
  margin-top: 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 12px 14px;
  background: #fafcff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-info {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

.btn-upload-local {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #fff;
  border: 1px solid #b9cddf;
  color: var(--navy);
  border-radius: 4px;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn-upload-local:hover {
  background: #eef5fc;
  border-color: var(--blue);
}

/* RIGHT COLUMN - RISK METRICS & CHARTS */
.risk-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Metric Trio */
.risk-trio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.risk-metric-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  position: relative;
  box-shadow: 0 1px 4px rgba(0, 12, 24, 0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}

.risk-metric-card.hero-metric {
  border-top: 4px solid var(--blue-deep);
  background: #fbfdff;
}

.metric-horizon {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-val-large {
  font-size: clamp(2.4rem, 3.4vw, 3.2rem);
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}

.risk-metric-card.hero-metric .metric-val-large {
  color: var(--blue-deep);
}

.metric-bar-bg {
  height: 6px;
  background: #e6eef5;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.metric-bar-fill {
  height: 100%;
  background: var(--blue-deep);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.metric-footer-note {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Trajectory status badge */
.trajectory-badge-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.traj-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.traj-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 800;
}

.traj-icon-box.rising {
  background: var(--risk-high-bg);
  color: var(--risk-high);
  border: 1px solid var(--risk-high-border);
}

.traj-icon-box.improving {
  background: var(--risk-low-bg);
  color: var(--risk-low);
  border: 1px solid var(--risk-low-border);
}

.traj-icon-box.stable {
  background: #f1f5fa;
  color: var(--muted);
  border: 1px solid var(--line);
}

.traj-text-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--navy);
}

.traj-text-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Charts Card */
.charts-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.chart-subcard {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
}

.chart-subcard-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 4px;
}

.chart-subcard-caption {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.svg-chart-wrapper {
  width: 100%;
  height: 180px;
}

.svg-chart-wrapper svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Assessment Card */
.assessment-card {
  background: #fdfefe;
  border: 1px solid var(--line);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
}

.assessment-text {
  font-size: 0.92rem;
  color: #213a52;
  line-height: 1.55;
}

.assessment-text strong {
  color: var(--navy);
}

/* Quick Jump Banner */
.jump-banner {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.jump-text {
  font-size: 0.92rem;
  color: #d1e2f4;
}

.jump-text strong {
  color: #fff;
}

.btn-jump {
  background: var(--lime);
  color: var(--navy);
  font-weight: 800;
  font-size: 0.84rem;
  padding: 10px 18px;
  border-radius: 6px;
  transition: transform 0.15s, background 0.15s;
  white-space: nowrap;
}

.btn-jump:hover {
  background: #eff729;
  transform: translateY(-2px);
}

/* ============================================================ */
/* MODULE 3: POPULATION INTELLIGENCE STYLES                      */
/* ============================================================ */

/* KPI Row - 3 Primary Indicators */
.cohort-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 14px;
}

.kpi-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  position: relative;
  box-shadow: 0 1px 4px rgba(0, 12, 24, 0.03);
}

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

.kpi-num {
  font-size: clamp(2rem, 2.6vw, 2.6rem);
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 6px;
}

.kpi-card.highlight .kpi-num {
  color: var(--blue-deep);
}

.kpi-card.warning .kpi-num {
  color: var(--risk-high);
}

.kpi-sub {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Secondary Statistical Detail */
.cohort-secondary-stat {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.78rem;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.cohort-secondary-stat strong {
  color: var(--navy);
  font-weight: 800;
}

.sec-stat-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* Capacity Simulator Box */
.capacity-simulator-box {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue-deep);
  border-radius: var(--radius-md);
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: 0 2px 10px rgba(0, 12, 24, 0.04);
}

.sim-header {
  margin-bottom: 20px;
}

.sim-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 4px;
}

.sim-question {
  font-size: 0.95rem;
  color: #3b5670;
  font-weight: 600;
}

.sim-control-row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.sim-slider-wrap {
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.sim-slider {
  flex: 1;
  height: 8px;
  -webkit-appearance: none;
  background: #e2eaf2;
  border-radius: 4px;
  outline: none;
}

.sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue-deep);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.1s;
}

.sim-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.sim-val-badge {
  background: var(--navy);
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 800;
  min-width: 85px;
  text-align: center;
}

.sim-preset-pills {
  display: flex;
  gap: 8px;
}

.sim-preset-btn {
  padding: 6px 12px;
  background: #f0f4f9;
  border: 1px solid #d3e0ec;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
  transition: all 0.15s;
}

.sim-preset-btn:hover {
  background: #e2ebf5;
}

.sim-preset-btn.active {
  background: var(--blue-deep);
  color: #fff;
  border-color: var(--blue-deep);
}

/* Simulator Output Banner (Narrative & Dual Metrics) */
.sim-impact-banner {
  background: #f4f8fe;
  border: 1px solid #c9dcf8;
  border-radius: 8px;
  padding: 20px 24px;
}

.sim-summary-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 4px;
}

.sim-summary-sub {
  font-size: 0.86rem;
  color: #3b5670;
  margin-bottom: 18px;
  line-height: 1.45;
}

.sim-metric-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.sim-metric-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0, 12, 24, 0.02);
}

.sim-metric-card.highlight {
  border-color: #bfd7f7;
  border-left: 4px solid var(--blue-deep);
  background: #fdfefe;
}

.sim-metric-card .sim-m-lbl {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.sim-metric-card.highlight .sim-m-lbl {
  color: var(--blue-deep);
}

.sim-metric-card .sim-m-val {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 4px;
}

.sim-metric-card.highlight .sim-m-val {
  color: var(--blue-deep);
}

.sim-metric-card .sim-m-sub {
  font-size: 0.74rem;
  color: #64748b;
}

.sim-disclaimer {
  font-size: 0.74rem;
  color: #71879c;
  font-style: italic;
  margin-top: 10px;
}

/* Population Visuals Grid: Histogram & Filters */
.pop-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px;
}

.chart-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 4px;
}

.chart-desc {
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.histogram-svg-wrap {
  width: 100%;
  height: 160px;
}

/* Cohort Table Card */
.cohort-table-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 1px 6px rgba(0, 12, 24, 0.03);
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 9px 14px 9px 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.84rem;
  font-family: inherit;
  color: var(--navy);
  background: #fcfdfe;
}

.search-input:focus {
  outline: 2px solid var(--blue);
  border-color: var(--blue);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: #8da1b5;
  font-size: 0.85rem;
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill-btn {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: #f1f5fa;
  color: #3b556e;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.filter-pill-btn:hover {
  background: #e4edf7;
  color: var(--navy);
}

.filter-pill-btn.active {
  background: var(--navy);
  color: #fff;
}

.filter-pill-btn.capacity-filter.active {
  background: var(--blue-deep);
  color: #fff;
}

/* Table Responsive wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

.cohort-table th {
  background: #f4f8fc;
  color: #3b556e;
  font-weight: 800;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.cohort-table th:hover {
  background: #eaf1f8;
  color: var(--navy);
}

.cohort-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #ecf1f6;
  vertical-align: middle;
}

.cohort-table tr:hover td {
  background: #f8fbff;
}

/* Row Highlights */
.cohort-table tr.demo-subject td {
  background: #fffde6 !important;
  font-weight: 600;
}

.cohort-table tr.in-capacity td {
  background: #f4f8fe;
}

.cohort-table tr.demo-subject:hover td {
  background: #fffbc4 !important;
}

/* Table Badges */
.badge-demo-tag {
  display: inline-block;
  background: var(--lime);
  color: var(--navy);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

.badge-capacity-tag {
  display: inline-block;
  background: rgba(32, 78, 194, 0.12);
  color: var(--blue-deep);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 6px;
}

.risk-cell-val {
  font-weight: 800;
  color: var(--navy);
}

.risk-cell-val.high {
  color: var(--risk-high);
}

.trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 0.74rem;
  padding: 2px 7px;
  border-radius: 4px;
}

.trend-pill.rising {
  background: var(--risk-high-bg);
  color: var(--risk-high);
}

.trend-pill.improving {
  background: var(--risk-low-bg);
  color: var(--risk-low);
}

.trend-pill.stable {
  background: #f1f5fa;
  color: var(--muted);
}

.status-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.status-pill.priority {
  background: var(--risk-high-bg);
  color: var(--risk-high);
  border: 1px solid var(--risk-high-border);
}

.status-pill.active {
  background: var(--risk-mid-bg);
  color: var(--risk-mid);
  border: 1px solid var(--risk-mid-border);
}

.status-pill.stable {
  background: #f1f5fa;
  color: var(--muted);
}

.btn-table-action {
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--navy);
  transition: all 0.15s;
}

.btn-table-action:hover {
  background: var(--navy);
  color: #fff;
}

/* Modal Drawer */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 12, 24, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: scaleUp 0.2s ease;
}

@keyframes scaleUp {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  background: var(--navy);
  color: #fff;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
}

.modal-close-btn {
  color: #9cb4c8;
  font-size: 1.5rem;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
}

.modal-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-risk-row {
  background: #f5f8fc;
  border-radius: 6px;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  margin-bottom: 20px;
}

.modal-risk-item .val {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--navy);
}

.modal-risk-item .lbl {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Footer */
.app-footer {
  background: var(--navy-deep);
  color: #8fa6bd;
  border-top: 1px solid var(--line-dark);
  padding: 24px 0;
  font-size: 0.78rem;
  margin-top: 40px;
}

.footer-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

/* ============================================================ */
/* PRODUCT FLOW: STEP 1 (CAPTURE), STEP 2 (PROCESSING), RESULTS */
/* ============================================================ */

.stage-capture {
  display: block;
  animation: fadeIn 0.3s ease;
}

.stage-capture.hidden {
  display: none;
}

.stage-results {
  display: block;
  animation: fadeIn 0.3s ease;
}

.stage-results.hidden {
  display: none;
}

/* Capture Hero Card */
.capture-hero-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 32px;
  box-shadow: 0 4px 16px rgba(0, 12, 24, 0.04);
  max-width: 980px;
  margin: 0 auto 30px;
}

.capture-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 32px;
  align-items: start;
  margin-top: 24px;
}

/* Dropzone */
.dropzone-container {
  border: 2px dashed #93b4dc;
  border-radius: 12px;
  background: #f8fbff;
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 290px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.dropzone-container:hover, .dropzone-container.dragover {
  border-color: var(--blue-deep);
  background: #edf5ff;
  box-shadow: 0 4px 12px rgba(32, 78, 194, 0.1);
}

/* Empty State Initial View */
.dropzone-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  width: 100%;
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #e1edfc;
  color: var(--blue-deep);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.dropzone-prompt {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.dropzone-hint {
  font-size: 0.76rem;
  color: var(--muted);
  max-width: 260px;
  line-height: 1.4;
  margin-bottom: 12px;
}

.dropzone-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  background: #eef4fb;
  color: #3b5b7b;
  border: 1px solid #d0e0f2;
  border-radius: 999px;
  padding: 4px 12px;
}

.dropzone-preview-wrap {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #000c18;
}

.dropzone-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dropzone-change-badge {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 12, 24, 0.85);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.capture-quick-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  width: 100%;
}

.btn-quick-sample {
  flex: 1;
  padding: 9px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  border: 1px solid var(--line);
}

.btn-quick-sample.primary-action {
  background: var(--blue-deep);
  color: #fff;
  border-color: var(--blue-deep);
}

.btn-quick-sample.primary-action:hover {
  background: #173b9e;
}

.btn-quick-sample.secondary-action {
  background: #fff;
  color: var(--navy);
  border-color: var(--line);
}

.btn-quick-sample.secondary-action:hover {
  background: #f0f4f9;
  border-color: var(--blue);
}

/* Capture Meta Form */
.capture-meta-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.context-info-card {
  background: #f8fbff;
  border: 1px solid #d5e2f0;
  border-left: 4px solid var(--blue-deep);
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.context-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.context-site-tag {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
}

.context-patient-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.context-patient-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
  letter-spacing: -0.01em;
}

.context-patient-desc {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

.context-clinical-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid #e1ecf8;
}

.context-meta-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.context-meta-k {
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

.context-meta-v {
  font-size: 0.82rem;
  color: var(--navy);
  font-weight: 700;
  line-height: 1.35;
}

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

.form-label {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy);
}

.context-pill-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.context-pill-btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.context-pill-btn:hover {
  border-color: var(--blue);
}

.context-pill-btn.active {
  background: var(--blue-deep);
  color: #fff;
  border-color: var(--blue-deep);
  box-shadow: 0 2px 6px rgba(32, 78, 194, 0.25);
}

.date-input-field {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.86rem;
  font-family: inherit;
  color: var(--navy);
  background: #fff;
}

.btn-start-simulation {
  margin-top: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  padding: 14px 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 12, 24, 0.15);
  transition: all 0.2s ease;
}

.btn-start-simulation:hover:not(:disabled) {
  background: #0d2844;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 12, 24, 0.22);
}

.btn-start-simulation:disabled, .btn-start-simulation.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.simulation-hint-text {
  font-size: 0.74rem;
  color: #64748b;
  text-align: center;
  margin-top: 4px;
}

/* Processing Simulation Modal */
.processing-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 12, 24, 0.85);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.processing-modal-backdrop.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.processing-card {
  background: #000c18;
  border: 1px solid rgba(96, 141, 255, 0.35);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  padding: 36px 30px;
  color: #fff;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

.scanner-stage {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  border: 3px solid var(--blue);
  box-shadow: 0 0 22px rgba(96, 141, 255, 0.4);
}

.scanner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.laser-scanner-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
  animation: scanUpDown 1.5s ease-in-out infinite alternate;
}

@keyframes scanUpDown {
  from { top: 8%; }
  to { top: 88%; }
}

.processing-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.processing-subtitle {
  font-size: 0.8rem;
  color: #9cbcd8;
  margin-bottom: 22px;
}

.processing-step-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.proc-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.proc-step-text {
  font-size: 0.84rem;
  font-weight: 600;
  color: #e2eaf2;
}

.proc-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

.proc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--lime));
  width: 0%;
  transition: width 0.3s ease;
}

/* Results Stage Header & Explanation */
.results-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-load-another {
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-load-another:hover {
  background: #f1f5fa;
  border-color: var(--blue);
}

.risk-explanation-callout {
  background: #f6f9fc;
  border: 1px solid #dbe6f2;
  border-left: 4px solid var(--blue-deep);
  border-radius: 6px;
  padding: 12px 18px;
  font-size: 0.85rem;
  color: #1a3854;
  line-height: 1.5;
  margin-bottom: 18px;
}

/* Stacked Capacity Histogram Legend & Visuals */
.histogram-legend-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.hist-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
}

.hist-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

.hist-swatch.selected {
  background: var(--blue-deep);
}

.hist-swatch.non-selected {
  background: #cbd5e1;
}

.histogram-svg-wrap {
  width: 100%;
  height: 220px;
}

/* Responsive */
@media (max-width: 1100px) {
  .individual-grid {
    grid-template-columns: 1fr;
  }
  .cohort-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .pop-dual-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
  }
  .brand-group {
    width: 100%;
    justify-content: space-between;
  }
  .nav-tabs {
    width: 100%;
    justify-content: stretch;
  }
  .tab-btn {
    flex: 1;
    text-align: center;
  }
  .risk-trio-grid {
    grid-template-columns: 1fr;
  }
  .charts-dual-grid {
    grid-template-columns: 1fr;
  }
  .cohort-kpi-grid {
    grid-template-columns: 1fr;
  }
  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input-wrap {
    max-width: none;
  }
  .capture-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

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