* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
  color: white;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 1.1rem; margin: 0; font-weight: 600; }
.linkbtn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.9rem;
  padding: 6px 10px;
  cursor: pointer;
}
main { padding: 16px; max-width: 520px; margin: 0 auto; }
.screen h2 { margin-top: 0; font-size: 1.3rem; }

.stack { display: flex; flex-direction: column; gap: 14px; }
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: #334155;
}
input[type="text"],
input[type="email"],
input[type="password"],
select {
  font-size: 16px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: white;
  width: 100%;
}
input:focus, select:focus {
  outline: 2px solid #2563eb;
  outline-offset: 0;
  border-color: #2563eb;
}

.photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.photo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  padding: 10px;
  background: white;
  min-height: 140px;
  cursor: pointer;
}
.photo-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #475569;
}
.photo input[type="file"] { font-size: 0.85rem; }
.photo-preview {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
}

.btn {
  font-size: 1rem;
  padding: 14px 18px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
}
.btn.primary { background: #2563eb; color: white; }
.btn.primary:hover { background: #1d4ed8; }
.btn.primary:disabled { background: #94a3b8; cursor: wait; }

.error {
  color: #dc2626;
  font-size: 0.9rem;
  margin: 6px 0 0;
  min-height: 1.2em;
}

#reportContent {
  background: white;
  padding: 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}
#reportContent dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0;
}
#reportContent dt { color: #64748b; }
#reportContent dd { margin: 0; color: #0f172a; }
#reportContent .status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 10px;
}

/* Phase 2: condition display */

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #eff6ff;
  color: #1e40af;
  border-radius: 8px;
  margin: 8px 0 14px;
  font-size: 0.9rem;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid #bfdbfe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#reportContent h3 { margin: 18px 0 8px; font-size: 1.05rem; color: #0f172a; }
#reportContent h4 { margin: 14px 0 6px; font-size: 0.9rem; color: #475569; }

.grade-band {
  display: inline-block;
  font-weight: 800;
  font-size: 1.4rem;
  padding: 10px 18px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  margin: 8px 0;
}
.band-psa10 { background: #dcfce7; color: #166534; border: 2px solid #22c55e; }
.band-psa9  { background: #fef3c7; color: #92400e; border: 2px solid #f59e0b; }
.band-raw   { background: #fee2e2; color: #991b1b; border: 2px solid #ef4444; }

.condition-score { margin: 8px 0 16px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.condition-score .score-num { font-size: 1.6rem; font-weight: 700; color: #0f172a; }
.condition-score .score-out { color: #64748b; font-size: 0.95rem; }

.subscores { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.subscore {
  display: grid;
  grid-template-columns: 80px 1fr 40px;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}
.subscore-label { color: #475569; }
.subscore-bar { height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden; }
.subscore-fill { height: 100%; border-radius: 5px; transition: width 0.3s ease; }
.subscore-fill.high { background: #22c55e; }
.subscore-fill.mid  { background: #f59e0b; }
.subscore-fill.low  { background: #ef4444; }
.subscore-num { text-align: right; font-family: ui-monospace, "SF Mono", Menlo, monospace; color: #0f172a; font-weight: 600; }

.centering-detail { font-size: 0.85rem; color: #475569; margin: 8px 0 4px; }
.defects { margin: 4px 0 12px; padding-left: 20px; font-size: 0.9rem; color: #0f172a; }
.defects li { margin-bottom: 4px; }
.notes {
  font-size: 0.9rem; color: #334155;
  background: #f1f5f9;
  padding: 10px 12px; border-radius: 8px;
  margin: 10px 0; line-height: 1.4;
}
.confidence { font-size: 0.85rem; color: #475569; margin: 10px 0 0; }

/* Status badge color variants */
.status-intake_received { background: #fef3c7; color: #92400e; }
.status-assessing       { background: #dbeafe; color: #1e40af; }
.status-condition_done  { background: #dcfce7; color: #166534; }
.status-error           { background: #fee2e2; color: #991b1b; }
