/* ---------- labs ---------- */
/* Averages table: a wide name column, numbers right-aligned under right-aligned headers. */
.table-stats th[scope='row'] {
  width: 30%;
}
.table-stats th.num {
  white-space: normal;
}

/* ---------- photos ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 8px !important;
}
@media (min-width: 900px) {
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}
.photo-tile {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
}
.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 4px;
  padding: 20px 6px 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  color: #fff;
  font-size: 0.75rem;
  text-align: left;
}
.photo-cap .badge {
  background: rgba(255, 255, 255, 0.9);
  color: #3b2150;
}
.photo-cap .badge-pre {
  color: #6b4500;
}
.photo-pose {
  opacity: 0.9;
}
.photo-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  margin-top: 10px;
  scroll-snap-type: x mandatory;
}
.strip-thumb {
  flex: 0 0 auto;
  width: 84px;
  height: 112px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
  scroll-snap-align: start;
}
.strip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Journal: a day's measurements on the timeline, and the check-in form's parts */
.measure-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 12px 0 0;
}
.measure-list dt {
  font-size: 0.82rem;
  color: var(--text-2);
}
.measure-list dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.checkin-part {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.checkin-part summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.05rem;
}
.checkin-part summary {
  list-style: none;
  min-height: 36px;
}
.checkin-part summary::-webkit-details-marker {
  display: none;
}
.checkin-part summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin-left: auto;
  margin-right: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.15s;
}
.checkin-part[open] summary::after {
  transform: translateY(2px) rotate(-135deg);
}
.checkin-part[open] summary {
  margin-bottom: 12px;
}
.checkin-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.checkin-photo {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 96px;
}
.checkin-photo img {
  width: 96px;
  height: 128px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface-2);
}
.checkin-photo .photo-pose {
  font-size: 0.78rem;
  color: var(--text-2);
}
.checkin-photo.removed img {
  opacity: 0.35;
}
.photo-sources {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.source-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: 0.85rem var(--font);
  text-align: left;
  cursor: pointer;
}
.source-btn .icon {
  color: var(--accent);
}
.source-btn span {
  color: var(--muted);
}
.source-btn:hover {
  border-color: var(--accent);
}
.add-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.add-item {
  display: grid;
  grid-template-columns: 96px 1fr 40px;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-2);
  align-items: start;
}
.add-thumb {
  width: 96px;
  height: 128px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-3);
}
.add-thumb-bad {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  text-align: center;
  color: var(--muted);
}
.add-fields {
  display: grid;
  gap: 8px;
}

/* viewer */
.modal-viewer .modal-body {
  display: flex;
  flex-direction: column;
  padding: 0;
}
.viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  touch-action: pan-y;
}
.viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
}
.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}
.viewer-nav:hover {
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
}
.viewer-nav.prev {
  left: 10px;
}
.viewer-nav.next {
  right: 10px;
}
.viewer-info {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: grid;
  gap: 4px;
}
.viewer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* compare */
.compare-controls {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  align-items: end;
}
@media (min-width: 760px) {
  .compare-controls {
    grid-template-columns: 1fr 1fr auto;
  }
}
.compare-between {
  text-align: center;
  color: var(--text-2);
  font-weight: 600;
  margin: 10px 0;
}
.compare-stage.side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.compare-stage figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.compare-stage img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #000;
  border-radius: 10px;
}
.compare-stage figcaption {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}
.slider-box {
  position: relative;
  margin: 0 auto;
  max-width: min(640px, 55vh);
  touch-action: none;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.slider-box img {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  border-radius: 0;
  pointer-events: none;
}
.slider-top {
  position: absolute;
  inset: 0;
}
.slider-top img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  margin-left: -1.5px;
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.slider-range {
  display: block;
  width: 100%;
  max-width: min(640px, 55vh);
  margin: 10px auto;
}
.slider-caps {
  display: flex;
  justify-content: space-between;
  max-width: min(640px, 55vh);
  margin: 0 auto;
}
.slider-caps figcaption:last-child {
  text-align: right;
}

/* camera */
.modal-camera .modal-body {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: #000;
}
.cam-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.cam-video,
.cam-ghost {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.cam-ghost {
  pointer-events: none;
}
.cam-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.cam-controls {
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
  color: #fff;
  background: #000;
}
.cam-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cam-ctl {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: transparent !important;
}
.cam-ctl[aria-pressed='true'] {
  background: rgba(255, 255, 255, 0.32) !important;
}
.cam-ghost-ctl {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}
.shutter {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  box-shadow: inset 0 0 0 3px #000;
}
.shutter:active {
  transform: scale(0.94);
}

/* hair */
.area-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.area-card {
  display: flex;
  gap: 12px;
}
.area-thumb {
  flex: 0 0 90px;
  height: 120px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
}
.area-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.area-body {
  flex: 1;
  min-width: 0;
}
.big-num {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.1;
  margin: 6px 0;
}

