@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
}

body {
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(13, 148, 136, 0.12), transparent 30%),
    radial-gradient(circle at 85% 10%, rgba(245, 158, 11, 0.12), transparent 25%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.step-card {
  transition: opacity 180ms ease, transform 180ms ease;
}

.field {
  display: grid;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: #0f172a;
}

.field > span {
  font-weight: 600;
  color: #334155;
}

.field input,
.field select,
.field textarea,
.slider-row input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 0.65rem;
  padding: 0.55rem 0.7rem;
  background: #fff;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.slider-row input:focus {
  outline: 2px solid #0d9488;
  outline-offset: 1px;
  border-color: #0d9488;
}

.btn-primary,
.btn-secondary {
  border-radius: 0.7rem;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  transition: all 150ms ease;
}

.btn-primary {
  background: linear-gradient(130deg, #0d9488, #0f766e);
  color: #f8fafc;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  border: 1px solid #94a3b8;
  background: #fff;
  color: #334155;
}

.btn-secondary:hover {
  border-color: #64748b;
  color: #0f172a;
}

.btn-compact {
  padding: 0.38rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 0.55rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.7rem;
  padding: 0.65rem 0.8rem;
  font-size: 0.9rem;
  color: #1e293b;
  background: #f8fafc;
}

.check-row input {
  width: 1rem;
  height: 1rem;
}

.error-text {
  border: 1px solid #fda4af;
  background: #fff1f2;
  color: #9f1239;
  border-radius: 0.6rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
}

.metric-card {
  border: 1px solid #cbd5e1;
  border-radius: 0.85rem;
  background: #f8fafc;
  padding: 0.85rem;
}

.metric-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}

.metric-main {
  margin-top: 0.35rem;
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
}

.score-bad {
  color: #b91c1c !important;
}

.score-fair {
  color: #b45309 !important;
}

.score-good {
  color: #0369a1 !important;
}

.score-great {
  color: #047857 !important;
}

.score-card-bad {
  border-color: #fecaca !important;
  background: #fff1f2 !important;
}

.score-card-fair {
  border-color: #fed7aa !important;
  background: #fffbeb !important;
}

.score-card-good {
  border-color: #bae6fd !important;
  background: #f0f9ff !important;
}

.score-card-great {
  border-color: #a7f3d0 !important;
  background: #ecfdf5 !important;
}

.readonly-box {
  border: 1px dashed #94a3b8;
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.slider-row output {
  min-width: 2rem;
  text-align: center;
  font-weight: 700;
  color: #0f766e;
}

.chart-wrap {
  position: relative;
  height: 280px;
}

.step-nav-btn {
  width: 100%;
  text-align: left;
  border: 1px solid #cbd5e1;
  border-radius: 0.6rem;
  padding: 0.55rem 0.75rem;
  font-weight: 600;
  transition: all 150ms ease;
}

.step-nav-btn:hover {
  border-color: #0d9488;
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}

.patient-summary .summary-chip {
  border: 1px solid #cbd5e1;
  border-radius: 0.55rem;
  background: #ffffff;
  padding: 0.45rem 0.6rem;
}

.patient-summary .summary-chip strong {
  color: #334155;
  margin-right: 0.3rem;
}

.knee3d-panel {
  background: #fff;
}

.knee3d-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.knee3d-split-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.knee3d-subcard {
  border: 1px solid #dbeafe;
  border-radius: 0.7rem;
  background: #ffffff;
  padding: 0.55rem;
}

.knee3d-subtitle {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #334155;
}

.knee3d-status {
  margin-top: 0.65rem;
  border-radius: 0.6rem;
  border: 1px solid #fbbf24;
  background: #fffbeb;
  color: #92400e;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
}

.knee3d-status[data-status-level='info'] {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: #075985;
}

.knee3d-viewport {
  height: 320px;
  border-radius: 0.75rem;
  border: 1px solid #cbd5e1;
  background:
    radial-gradient(circle at 12% 14%, rgba(15, 118, 110, 0.1), transparent 30%),
    linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  overflow: hidden;
}

.knee3d-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.knee3d-explainer {
  border: 1px solid #dbeafe;
  background: #f8fbff;
  border-radius: 0.6rem;
  padding: 0.65rem 0.75rem;
  color: #334155;
  font-size: 0.78rem;
  line-height: 1.45;
}

.knee3d-explainer-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1e3a8a;
  cursor: pointer;
  list-style: none;
}

.knee3d-explainer-title::-webkit-details-marker {
  display: none;
}

.knee3d-explainer-title::before {
  content: '▸';
  margin-right: 0.35rem;
  color: #2563eb;
}

.knee3d-explainer[open] .knee3d-explainer-title::before {
  content: '▾';
}

.knee3d-explainer p {
  margin-top: 0.4rem;
}

@media (max-width: 768px) {
  .chart-wrap {
    height: 240px;
  }

  .knee3d-viewport {
    height: 240px;
  }

  .knee3d-split-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  body {
    background: #fff;
    margin: 0;
    padding: 0;
    color: #111827;
  }

  header,
  #stepIndicator,
  .btn-primary,
  .btn-secondary,
  textarea,
  input,
  select {
    display: none !important;
  }

  .step-card {
    border: 0;
    box-shadow: none;
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    break-inside: avoid-page;
  }

  .step-card.hidden {
    display: none !important;
  }

  main {
    max-width: 190mm !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 auto !important;
  }

  section,
  article,
  .metric-card,
  .patient-summary,
  .knee3d-panel {
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .chart-wrap {
    height: 70mm !important;
    max-height: 70mm !important;
    width: 100% !important;
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  canvas {
    max-width: 100% !important;
    max-height: 70mm !important;
  }

  .knee3d-panel {
    display: none !important;
  }

  .knee3d-explainer {
    display: none !important;
  }
}
