/* ==========================================================================
   CLINICAL LIGHT THEME — APPLE-INSPIRED FLOATING DOCK & FULL-WIDTH WORKSPACE
   Fetal Autopsy Standards: Bartosch et al. (2019) Virchows Archiv 475:611–623
   ========================================================================== */

:root {
  /* Clean Apple/Clinical Palette */
  --bg-page: #f3f8fc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --bg-input-focus: #f0f9ff;
  
  /* Text */
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Clinical Accents */
  --blue-primary: #0284c7;
  --blue-dark: #0369a1;
  --blue-subtle: #e0f2fe;
  --blue-border: #bae6fd;

  --emerald-main: #059669;
  --emerald-dark: #065f46;
  --emerald-subtle: #ecfdf5;
  --emerald-border: #a7f3d0;

  --amber-main: #d97706;
  --amber-dark: #92400e;
  --amber-subtle: #fffbeb;
  --amber-border: #fde68a;

  --rose-main: #e11d48;
  --rose-dark: #9f1239;
  --rose-subtle: #fff1f2;
  --rose-border: #fecdd3;

  --purple-main: #7c3aed;
  --purple-subtle: #f5f3ff;
  --purple-border: #ddd6fe;

  /* Borders & Shadows */
  --border-card: #e2e8f0;
  --border-divider: #cbd5e1;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 6px 16px -2px rgba(0, 0, 0, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 16px 36px -6px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.03);
  --shadow-dock: 0 12px 32px -4px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.02);

  /* Fonts */
  --font-main: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
  background-color: var(--bg-page);
  background-image:
    radial-gradient(circle at 8% 4%, rgba(186, 230, 253, 0.45), transparent 28rem),
    radial-gradient(circle at 92% 24%, rgba(209, 250, 229, 0.35), transparent 26rem),
    linear-gradient(135deg, #f8fcff 0%, #eff7fc 48%, #f6fbf9 100%);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image: radial-gradient(rgba(2, 132, 199, 0.16) 0.8px, transparent 0.8px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 78%);
}

/* --------------------------------------------------------------------------
   SUBTLE ANIMATED MEDICAL AMBIENT MESH (CLEAN & ELEGANT)
   -------------------------------------------------------------------------- */
.clinical-ambient-mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.6;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}

.mesh-orb-1 {
  top: -120px;
  left: 10%;
  width: 540px;
  height: 540px;
  background: radial-gradient(circle, rgba(186, 230, 253, 0.85) 0%, rgba(224, 242, 254, 0.2) 70%);
  animation: floatOrb1 20s infinite alternate;
}

.mesh-orb-2 {
  top: 35%;
  right: 5%;
  width: 580px;
  height: 580px;
  background: radial-gradient(circle, rgba(167, 243, 208, 0.7) 0%, rgba(236, 253, 245, 0.15) 70%);
  animation: floatOrb2 24s infinite alternate;
}

.mesh-orb-3 {
  bottom: -100px;
  left: 25%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(221, 214, 254, 0.65) 0%, rgba(245, 243, 255, 0.1) 70%);
  animation: floatOrb3 22s infinite alternate;
}

@keyframes floatOrb1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 80px) scale(1.1); }
  100% { transform: translate(-40px, 40px) scale(0.95); }
}

@keyframes floatOrb2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-80px, -50px) scale(1.15); }
  100% { transform: translate(40px, 60px) scale(0.9); }
}

@keyframes floatOrb3 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(70px, -60px) scale(1.08); }
  100% { transform: translate(-50px, -30px) scale(0.92); }
}

/* --------------------------------------------------------------------------
   FULL WIDTH APP CONTAINER (FILLS ENTIRE SCREEN EDGE-TO-EDGE)
   -------------------------------------------------------------------------- */
.app-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 16px 48px 16px;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .app-layout {
    padding: 0 28px 48px 28px;
  }
}

@media (min-width: 1600px) {
  .app-layout {
    padding: 0 40px 48px 40px;
  }
}

/* --------------------------------------------------------------------------
   FLOATING APPLE-STYLE DOCK NAVBAR
   -------------------------------------------------------------------------- */
.clinical-header {
  position: sticky;
  top: 14px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 22px;
  margin: 12px 0 22px 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-dock);
  transition: var(--transition);
}

.clinical-header:hover {
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.02);
  border-color: rgba(186, 230, 253, 0.8);
}

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

.brand-symbol {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--blue-primary), #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.brand-symbol:hover {
  transform: scale(1.05);
}

.brand-symbol svg {
  width: 22px;
  height: 22px;
}

.brand-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-title-line h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.clinical-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--blue-subtle);
  border: 1px solid var(--blue-border);
  color: var(--blue-dark);
}

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

/* Header Action Buttons */
.header-toolset {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-tool {
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: #ffffff;
  border: 1px solid var(--border-card);
  color: var(--text-body);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-tool svg {
  width: 14px;
  height: 14px;
  transition: transform 0.18s ease;
}

.btn-tool:hover {
  background: var(--bg-card-subtle);
  border-color: var(--border-divider);
  color: var(--text-main);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.btn-tool:hover svg {
  transform: scale(1.15);
}

.btn-tool:active {
  transform: scale(0.96);
  box-shadow: none;
}

.btn-report-main {
  background: linear-gradient(135deg, var(--blue-primary), #0284c7);
  border-color: var(--blue-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.btn-report-main:hover {
  background: linear-gradient(135deg, var(--blue-dark), #0369a1);
  border-color: var(--blue-dark);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.4);
}

.btn-clear:hover {
  background: var(--rose-subtle);
  border-color: var(--rose-border);
  color: var(--rose-main);
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.15);
}

/* --------------------------------------------------------------------------
   CASE METADATA & CLINICAL TARGET WEEK STRIP (FLUID, NO OVERFLOW)
   -------------------------------------------------------------------------- */
.case-meta-strip {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 16px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  width: 100%;
  box-sizing: border-box;
  transition: var(--transition);
}

.case-meta-strip:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.meta-strip-header {
  margin-bottom: 12px;
}

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

.meta-strip-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
}

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

@media (min-width: 1024px) {
  .meta-strip-grid {
    grid-template-columns: 1.2fr 1.5fr 0.9fr 1fr 1.1fr 1.2fr;
  }
}

.meta-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.meta-field label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-body);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: normal;
}

.tooltip-hint {
  cursor: help;
  font-size: 0.75rem;
}

.meta-field input, .meta-field select {
  height: 38px;
  padding: 0 12px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.meta-field input:focus, .meta-field select:focus {
  background: #ffffff;
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 2px var(--blue-subtle);
}

.select-target-week {
  background: #f0f9ff !important;
  border-color: var(--blue-border) !important;
  color: var(--blue-dark) !important;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   MASTER RESULT HERO CARD (FULL WIDTH WORKSTATION WIDGET)
   -------------------------------------------------------------------------- */
.master-result-card {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  transition: var(--transition);
}

.master-result-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: #94a3b8;
}

@media (min-width: 992px) {
  .master-result-card {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(250px, 1.1fr);
    gap: 28px;
  }
}

.result-card-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.result-title-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--blue-primary);
  text-transform: uppercase;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-main);
  display: inline-block;
  box-shadow: 0 0 0 3px var(--emerald-subtle);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.6; }
}

.result-number-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.result-huge-number {
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.03em;
  line-height: 1;
}

.result-number-unit {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
}

.result-milestone-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-body);
  margin-top: 4px;
}

.clinical-comparison-pill {
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
}

.comp-aig { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.comp-pig { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.comp-gig { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }

/* Timeline center gauge */
.result-card-center {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.timeline-ticks-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.timeline-bar-track {
  height: 14px;
  background: #e2e8f0;
  border-radius: 99px;
  position: relative;
  overflow: hidden;
}

.timeline-bar-fill {
  position: absolute;
  top: 0;
  height: 100%;
  left: 0;
  width: 0;
  background: linear-gradient(90deg, #0284c7, #059669);
  border-radius: 99px;
  transition: all 0.35s ease;
}

.target-week-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #f59e0b;
  border-radius: 2px;
  z-index: 2;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.8);
}

.timeline-caption {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

/* Mini checklist table on right */
.result-card-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.summary-mini-table {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
}

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

.mini-lbl {
  color: var(--text-muted);
}

.mini-val {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-weight: 700;
}

.mini-row-outlier {
  color: var(--amber-main);
  font-weight: 700;
  border-top: 1px dashed var(--border-card);
  padding-top: 4px;
}

.quick-action-buttons {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, auto);
  gap: 8px;
  min-width: 0;
}

.btn-fast-report {
  min-width: 0;
  padding: 10px 12px;
  background: var(--blue-subtle);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-sm);
  color: var(--blue-dark);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  white-space: normal;
  overflow-wrap: anywhere;
}

.btn-fast-report:hover {
  background: var(--blue-primary);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.btn-fast-report:active {
  transform: scale(0.97);
}

.btn-save-draft {
  min-width: 0;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: var(--text-body);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.2s ease;
  white-space: normal;
  overflow-wrap: anywhere;
}

.btn-save-draft:hover {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.btn-save-draft:active {
  transform: scale(0.97);
}

/* --------------------------------------------------------------------------
   DIAGNOSTIC RATIOS & FETAL PATHOLOGY INDICES (FLUID FULL-WIDTH)
   -------------------------------------------------------------------------- */
.ratios-card {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
  transition: var(--transition);
}

.ratios-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

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

.ratios-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.04em;
}

.ratios-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ratios-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
}

@media (min-width: 600px) {
  .ratios-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .ratios-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.ratio-item-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.ratio-item-box:hover {
  transform: translateY(-2px);
  border-color: var(--blue-border);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.08);
}

.ratio-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
}

.ratio-value {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.ratio-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.25;
}

.ratio-status-alert {
  color: #c2410c !important;
  font-weight: 700;
}

.ratio-status-normal {
  color: #059669 !important;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   FILTER TABS
   -------------------------------------------------------------------------- */
.category-filter-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-filter-nav::-webkit-scrollbar {
  display: none;
}

.filter-tab-btn {
  flex-shrink: 0;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: #ffffff;
  border: 1px solid var(--border-card);
  color: var(--text-body);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.filter-tab-btn:hover {
  background: var(--bg-card-subtle);
  border-color: var(--border-divider);
  transform: translateY(-1px);
}

.filter-tab-btn.active {
  background: var(--blue-primary);
  border-color: var(--blue-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.tab-pill-count {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: #f1f5f9;
  color: var(--text-main);
}

.filter-tab-btn.active .tab-pill-count {
  background: #ffffff;
  color: var(--blue-dark);
}

/* --------------------------------------------------------------------------
   SECTIONS & PARAMETER CARDS (FULL WIDTH MULTI-COLUMN)
   -------------------------------------------------------------------------- */
.clinical-section {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

.clinical-section.hidden {
  display: none !important;
}

.section-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-card);
  margin-bottom: 18px;
}

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

.section-num-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-primary);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-title-wrap h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.section-title-wrap p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.section-result-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-card);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  color: var(--text-body);
}

.section-result-pill strong {
  color: var(--emerald-main);
  font-weight: 800;
  font-family: var(--font-mono);
}

/* Fluid Auto-Fit Multi-Column Grid (Fills Ultra-Wide Displays) */
.clinical-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 540px) {
  .clinical-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (min-width: 1400px) {
  .clinical-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  }
}

@media (min-width: 2000px) {
  .clinical-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

/* Parameter Card with Dynamic Hover Reaction */
.param-card-clinical {
  background: #ffffff;
  border: 1.5px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  min-width: 0;
  box-sizing: border-box;
}

.param-card-clinical:hover {
  border-color: #7dd3fc;
  box-shadow: 0 10px 24px -4px rgba(2, 132, 199, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.04);
  transform: translateY(-3px);
}

.param-card-clinical.has-value {
  border-color: var(--emerald-border);
  background: var(--emerald-subtle);
}

.param-card-clinical.is-outlier {
  border-color: var(--amber-border) !important;
  background: var(--amber-subtle) !important;
}

.param-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.param-name-txt {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.param-unit-txt {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 500;
  margin-top: 2px;
}

.btn-open-ref-table {
  background: #ffffff;
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.btn-open-ref-table:hover {
  background: var(--blue-subtle);
  color: var(--blue-dark);
  border-color: var(--blue-border);
  transform: scale(1.12);
}

.btn-open-ref-table:active {
  transform: scale(0.94);
}

/* ==========================================================================
   UNIFIED INTEGRATED INPUT GROUP (SEGMENTED CONTROL)
   ========================================================================== */
.param-input-cluster {
  display: flex;
  align-items: stretch;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 42px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.param-input-cluster:focus-within {
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
}

.param-input-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.param-subfield {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.param-subfield-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.btn-stepper {
  width: 44px;
  background: #f8fafc;
  border: none;
  color: #475569;
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  flex-shrink: 0;
}

.btn-stepper.btn-minus {
  border-right: 1px solid #e2e8f0;
}

.btn-stepper.btn-plus {
  border-left: 1px solid #e2e8f0;
}

.btn-stepper:hover {
  background: #e0f2fe;
  color: #0284c7;
}

.btn-stepper:active {
  background: #0284c7;
  color: #ffffff;
  transform: scale(0.92);
}

.param-real-input,
.param-secondary-input {
  flex: 1;
  min-width: 0;
  border: none;
  height: 100%;
  background: #ffffff;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  outline: none;
  padding: 0 6px;
  box-sizing: border-box;
  -moz-appearance: textfield;
}

.param-real-input::-webkit-outer-spin-button,
.param-real-input::-webkit-inner-spin-button,
.param-secondary-input::-webkit-outer-spin-button,
.param-secondary-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.param-real-input::placeholder,
.param-secondary-input::placeholder {
  color: #cbd5e1;
  font-weight: 500;
}

/* Multi-line Tag Status Row */
.param-tag-status-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.72rem;
  min-height: 20px;
}

.tag-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.72rem;
  line-height: 1.2;
}

.tag-confluent {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.tag-outlier {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.tag-outrange {
  background: #ffe4e6;
  color: #9f1239;
  border: 1px solid #fecdd3;
}

.tag-descriptive {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* Target Week comparison tags */
.tag-target-below {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-weight: 800;
}

.tag-target-normal {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-weight: 800;
}

.tag-target-above {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
  font-weight: 800;
}

.section-alert-bar {
  margin-top: 16px;
  padding: 10px 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  color: #92400e;
  font-size: 0.78rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */
.clinical-footer {
  margin-top: 10px;
}

.footer-citation-box {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  font-size: 0.78rem;
  color: var(--text-body);
  line-height: 1.5;
}

.footer-citation-box .text-sub {
  color: var(--text-muted);
  font-size: 0.74rem;
}

/* --------------------------------------------------------------------------
   MODALS (REPORT, HISTORY, STANDARD TABLE)
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog-report {
  width: 100%;
  max-width: 900px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 94vh;
}

.modal-dialog-history, .modal-dialog-table {
  width: 100%;
  max-width: 760px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}

.modal-header-clinical {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-card);
}

.modal-header-clinical h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.modal-header-clinical p {
  font-size: 0.76rem;
  color: var(--text-muted);
}

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

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

.modal-body-clinical {
  padding: 20px 24px;
  overflow-y: auto;
  background: #f8fafc;
}

.modal-footer-clinical {
  padding: 16px 24px;
  background: #ffffff;
  border-top: 1px solid var(--border-card);
}

/* Printable Report Paper Preview Styling */
.report-paper-preview {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  font-family: 'Inter', -apple-system, sans-serif;
  color: #0f172a;
}

.report-paper-header {
  text-align: center;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.report-inst-title {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #475569;
}

.report-sub-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: #0f172a;
  margin: 4px 0;
}

.report-date-line {
  font-size: 0.78rem;
  color: #64748b;
  font-family: var(--font-mono);
}

/* Meta Grid in Report */
.report-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.8rem;
  margin-bottom: 18px;
}

.report-box-result {
  background: #f0f9ff;
  border: 2px solid #0284c7;
  border-radius: 8px;
  padding: 16px 20px;
  text-align: center;
  margin-bottom: 20px;
}

.rep-res-lbl {
  font-size: 0.75rem;
  font-weight: 800;
  color: #0369a1;
  letter-spacing: 0.06em;
}

.rep-res-val {
  font-size: 2.2rem;
  font-weight: 900;
  color: #0c4a6e;
  margin: 4px 0;
}

.rep-res-sub {
  font-size: 0.82rem;
  font-weight: 600;
  color: #0284c7;
}

.rep-res-clinical-eval {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f766e;
  margin-top: 6px;
}

/* Ratios summary in report */
.report-ratios-summary {
  margin-bottom: 20px;
}

.rep-ratios-list {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-table-section {
  margin-bottom: 20px;
}

.rep-sec-title {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #334155;
  border-bottom: 1.5px solid #cbd5e1;
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.report-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.report-data-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #cbd5e1;
}

.report-data-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}

.report-notes-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 0.76rem;
  color: #475569;
  line-height: 1.5;
  margin-bottom: 24px;
}

.report-signature-row {
  display: flex;
  justify-content: space-between;
  margin-top: 36px;
  padding-top: 10px;
}

.sig-col {
  width: 42%;
  text-align: center;
}

.sig-line {
  border-bottom: 1px solid #94a3b8;
  height: 30px;
  margin-bottom: 6px;
}

.sig-col span {
  font-size: 0.74rem;
  color: #64748b;
}

/* Report model: follows the supplied DOCX example (intro, ordered findings, conclusion) */
.report-paper-preview {
  font-family: 'Calibri', 'Arial', sans-serif;
  color: #222222;
  font-size: 11pt;
  line-height: 1.35;
}

.report-model-header {
  border-bottom: 1px solid #a3a3a3;
  margin-bottom: 18px;
  padding-bottom: 8px;
}

.report-model-title {
  color: #1f2937;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.report-date-line,
.report-case-line {
  color: #667085;
  font-size: 0.78rem;
}

.report-case-line {
  margin-top: 2px;
}

.report-intro {
  margin: 0 0 14px;
}

.report-age-list {
  margin: 0 0 18px;
  padding-left: 28px;
}

.report-age-list li {
  margin-bottom: 7px;
  padding-left: 4px;
}

.report-age-list li::marker {
  color: var(--blue-dark);
  font-weight: 700;
}

.report-ratio-section {
  border-top: 1px solid #d0d5dd;
  margin-top: 16px;
  padding-top: 12px;
}

.report-section-label {
  color: #344054;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.report-ratio-section .rep-ratios-list {
  background: #f8fafc;
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  gap: 5px;
  padding: 9px 12px;
}

.report-ratio-conclusion {
  font-weight: 600;
  margin: 12px 0 0;
}

.report-descriptive-note {
  color: #475467;
  font-size: 0.9rem;
  margin: 14px 0 0;
}

.report-conclusion {
  border-top: 1px solid #a3a3a3;
  font-size: 11pt;
  margin: 20px 0 0;
  padding-top: 12px;
}

/* Export Buttons in Modal */
.export-btn-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-export {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.btn-export svg {
  width: 16px;
  height: 16px;
}

.btn-word { background: #2b579a; color: #ffffff; }
.btn-word:hover { background: #1e3f6f; }

.btn-pdf { background: #0284c7; color: #ffffff; }
.btn-pdf:hover { background: #0369a1; }

.btn-copy { background: #ffffff; border-color: #cbd5e1; color: var(--text-body); }
.btn-copy:hover { background: #f1f5f9; color: var(--text-main); }

/* Saved Cases History List */
.saved-cases-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.saved-case-card {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.saved-case-card:hover {
  border-color: var(--blue-primary);
  box-shadow: var(--shadow-sm);
}

.saved-case-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.saved-case-title {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-main);
}

.saved-case-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.saved-case-actions {
  display: flex;
  gap: 8px;
}

.btn-case-load {
  padding: 6px 12px;
  background: var(--blue-subtle);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-sm);
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-case-del {
  padding: 6px 10px;
  background: var(--rose-subtle);
  border: 1px solid var(--rose-border);
  border-radius: var(--radius-sm);
  color: var(--rose-main);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

/* Table Standard Modal */
.table-modal-body {
  max-height: 480px;
}

.table-standard-ref {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.table-standard-ref th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 2px solid #cbd5e1;
  text-align: left;
}

.table-standard-ref td {
  padding: 8px 14px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  font-family: var(--font-mono);
}

.table-standard-ref tr.highlight-row td {
  background: #ecfdf5;
  color: #065f46;
  font-weight: 800;
}

/* --------------------------------------------------------------------------
   RESPONSIVE POLISH
   -------------------------------------------------------------------------- */
@media (max-width: 1150px) and (min-width: 768px) {
  .master-result-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .result-card-right {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 1.15fr);
    align-items: center;
  }
}

@media (max-width: 767px) {
  .app-layout {
    padding: 0 10px 32px;
  }

  .clinical-header {
    position: relative;
    top: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    margin: 8px 0 16px;
    border-radius: var(--radius-xl);
  }

  .header-main-brand {
    align-items: flex-start;
  }

  .brand-title-line h1 {
    font-size: 1rem;
  }

  .header-toolset {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .btn-tool {
    justify-content: center;
    min-width: 0;
    padding: 0 8px;
  }

  .case-meta-strip,
  .master-result-card,
  .ratios-card,
  .clinical-section {
    padding: 16px;
  }

  .master-result-card {
    gap: 16px;
  }

  .result-huge-number {
    font-size: 2.35rem;
  }

  .quick-action-buttons {
    grid-template-columns: 1fr;
  }

  .btn-fast-report,
  .btn-save-draft {
    min-height: 40px;
  }

  .section-top-bar {
    align-items: flex-start;
  }

  .section-result-pill {
    width: 100%;
    justify-content: space-between;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-header-clinical,
  .modal-body-clinical,
  .modal-footer-clinical {
    padding-left: 14px;
    padding-right: 14px;
  }

  .report-paper-preview {
    padding: 18px;
  }
}

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

.app-layout > .case-meta-strip,
.app-layout > .master-result-card,
.app-layout > .ratios-card,
.app-layout > .category-filter-nav,
.app-layout > .clinical-workspace {
  animation: surfaceIn 0.55s ease-out both;
}

.app-layout > .master-result-card { animation-delay: 0.05s; }
.app-layout > .ratios-card { animation-delay: 0.1s; }
.app-layout > .category-filter-nav { animation-delay: 0.15s; }
.app-layout > .clinical-workspace { animation-delay: 0.2s; }

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

/* --------------------------------------------------------------------------
   PRINT STYLES (@media print)
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-layout {
    display: none !important;
  }

  .no-print, .clinical-header, .modal-header-clinical, .modal-footer-clinical {
    display: none !important;
  }

  .modal-backdrop {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    display: block !important;
  }

  .modal-backdrop:not(#modalReport) {
    display: none !important;
  }

  .modal-dialog-report {
    max-width: 100% !important;
    box-shadow: none !important;
    border: none !important;
  }

  .modal-body-clinical {
    padding: 0 !important;
    background: none !important;
  }

  .report-paper-preview {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
}
