.workout-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid #d9e3da;
  border-radius: 14px;
  background: #d9e3da;
  margin: 18px 0;
}
.workout-metrics > div {
  background: #f6f8f4;
  color: #203c32;
  padding: clamp(10px, 2vw, 20px);
}
.workout-metrics > div:first-child { background: #45655b; color: white; }
.workout-metrics dt { font-size: .82rem; font-weight: 600; }
.workout-metrics dd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 .3em;
  margin: 4px 0 0;
  font-size: clamp(1.12rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.workout-metrics small { font-size: .7em; font-weight: 500; letter-spacing: normal; }
.workout-metrics > div:first-child small { color: #d4efaa; }
.diary-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
}
.diary-actions a, .diary-actions button {
  display: inline-block;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: #f0f4ee;
  color: #275440;
  font: inherit;
  font-size: .8rem;
  font-weight: 400;
  text-decoration: none;
}
.diary-actions :is(a, button):hover { background: #e0eadf; }

.workout-note {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 3px solid #83a996;
  border-radius: 0 8px 8px 0;
  background: #f3f7f3;
}
.workout-note h3 { margin: 0 0 4px; color: #355849; font-size: .95rem; }
.workout-note p { margin: 0; }

.workout-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(120px, 100%), 1fr));
  gap: 8px;
  margin: 16px 0;
}
.workout-gallery img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
@media (max-width: 500px) {
  .workout-metrics { grid-template-columns: 1fr 1fr; }
  .workout-metrics > div:first-child { grid-column: 1 / -1; }
}

.photo-viewer { margin: 0; }
.photo-viewer img {
  display: block;
  width: 100%;
  height: min(65vh, 680px);
  object-fit: contain;
  background: #16231e;
  border-radius: 12px;
}
.photo-viewer figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.photo-controls { display: flex; align-items: center; gap: 10px; }
.photo-controls a, .photo-back {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  background: #e4ece1;
  color: #234835;
  text-decoration: none;
}

.duration-fields { min-width: 0; margin: 0; padding: 0; border: 0; }
.duration-fields legend { padding: 0; margin-bottom: 4px; font-weight: 600; }
.duration-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.duration-row label { font-size: .85rem; }
#workout-photos input, #add-photos { margin-block: 4px; }
#photo-count { display: block; }

.fields .photo-picker {
  display: inline-block;
  position: relative;
  overflow: hidden;
  padding: 8px 14px;
  border-radius: 8px;
  background: #dce9df;
  cursor: pointer;
}
.photo-picker:focus-within { outline: 2px solid #365b49; }
.fields .photo-picker input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
#pending-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  list-style: none;
}
#pending-photos:empty { display: none; }
#pending-photos li { position: relative; }
#pending-photos img { display: block; width: 92px; height: 76px; object-fit: cover; border-radius: 8px; }
#pending-photos button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 27px;
  height: 27px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  color: #523c3c;
}
.viewer-actions, .photo-viewer figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.photo-delete summary { color: #646f68; font-size: .85rem; cursor: pointer; }
.photo-delete form { padding: 8px 0; }
.photo-delete button { background: #f0dedd; color: #6b3c40; }

.run-heading { display: grid; gap: 7px; }
.run-author-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 15px; }
.run-author { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
.run-author > :first-child { flex-shrink: 0; }
.run-author > span:last-child { overflow-wrap: anywhere; }
.run-subscription { margin: 0; }
.run-subscription button { padding: 4px 9px; font-size: .7em; line-height: 1.4; font-weight: 400; }
