.photo-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 0.51fr);
  align-items: start;
  gap: 1rem;
}
.photo-filebar, .photo-actions, .photo-view-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.photo-filebar { justify-content: space-between; margin-bottom: 0.8rem; }
.photo-file-info { min-width: 0; }
.photo-file-info h2 { margin-bottom: 0.12rem; }
.photo-file-info p, .photo-note { color: var(--measure-muted); font-size: 0.875rem; overflow-wrap: anywhere; }
.photo-file-info p { margin: 0; }
.photo-notice { padding: 0.6rem 0.75rem; border-radius: 0.5rem; background: #f5f7f1; }
.photo-notice[data-error="true"], .photo-note[data-error="true"] { color: #862e25; }
.photo-notice[data-error="true"] { background: #fbedeb; }
.photo-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  isolation: isolate;
  border-radius: 0.55rem;
  background: #e9eae6;
  box-shadow: inset 0 0 0 1px #bfc8bc;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}
.photo-stage:focus-visible { outline: 3px solid #1a68a7; outline-offset: 3px; }
.photo-stage[data-tool="reference"], .photo-stage[data-tool="measurement"] { cursor: crosshair; }
.photo-stage[data-tool="pan"] { cursor: grab; touch-action: none; }
.photo-stage[data-drag="pan"] { cursor: grabbing; }
#photo-canvas, .photo-handles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.photo-loading { position: absolute; inset: 0.75rem; display: grid; place-items: center; text-align: center; }
.photo-handle {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  touch-action: none;
  cursor: move;
}
.photo-handle:focus-visible { outline-offset: -5px !important; }
.photo-stage[data-tool="pan"] .photo-handle { pointer-events: none; }
.photo-stage[data-tool="reference"] .photo-handle, .photo-stage[data-tool="measurement"] .photo-handle { pointer-events: none; }
.photo-lens {
  position: absolute;
  z-index: 2;
  width: 112px;
  height: 112px;
  border: 2px solid white;
  border-radius: 50%;
  background: #e9eae6;
  box-shadow: 0 2px 10px #13251d82;
  pointer-events: none;
}
.photo-view-controls { margin-top: 0.75rem; }
.photo-view-controls .photo-icon-button { width: 2.75rem; padding: 0; font-size: 1.3rem; }
.photo-zoom { min-width: 3.1rem; text-align: center; font-variant-numeric: tabular-nums; }
.photo-stage-status { margin: 0.6rem 0 0 !important; min-height: 1.4em; color: #465847; }
.photo-control-group { padding-bottom: 0.8rem; border-bottom: 1px solid var(--measure-border); margin-bottom: 0.8rem; }
.photo-known-fields { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 0.65rem; margin-top: 0.65rem; }
.photo-control-group .photo-note { margin: 0.55rem 0 0; }
.photo-results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.55rem; margin: 0.7rem 0 0; padding: 0; list-style: none; }
.photo-results:empty { display: none; }
.photo-results li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.4rem; padding: 0.65rem 0.55rem 0.65rem 0.7rem; border: 1px solid #cbdcd2; border-radius: 0.5rem; background: #f1f7f2; }
.photo-results h3 { margin: 0 0 0.15rem; }
.photo-results output { color: #174432; font-weight: 800; font-variant-numeric: tabular-nums; }
.photo-results .photo-note { margin-top: 0; }
.photo-results .measure-button { min-width: 2.75rem; padding-inline: 0.5rem; }
.photo-output-actions { margin-bottom: 0.7rem; }
.photo-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.photo-workspace [hidden] { display: none !important; }

@media (max-width: 760px) {
  .photo-workspace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 540px) {
  .photo-filebar { align-items: start; flex-direction: column; }
  .photo-filebar .measure-button { padding-inline: 0.65rem; }
}
