.catalog-picker {
  display: grid;
  gap: 10px;
}

.catalog-search-row {
  display: flex;
  gap: 8px;
}

.catalog-search-row input {
  flex: 1;
  min-width: 0;
  padding: 13px 14px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 12px;
  outline: 0;
  font-size: 13px;
}

.catalog-search-row input:focus {
  border-color: var(--accent);
}

.catalog-search-row .secondary-button {
  flex: 0 0 auto;
  padding-left: 14px;
  padding-right: 14px;
}

.catalog-results {
  display: grid;
  gap: 8px;
}

.catalog-result {
  width: 100%;
  border: 1px solid transparent;
  text-align: left;
}

.catalog-result:hover {
  border-color: var(--accent);
}

.catalog-result > .icon:last-child {
  width: 15px;
  color: var(--muted);
}

.catalog-result__copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.catalog-result__copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-result__copy span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.ai-hypothesis-row {
  width: 100%;
  border: 1px solid transparent;
  text-align: left;
  cursor: pointer;
}

.ai-hypothesis-row:hover,
.ai-hypothesis-row:focus-visible {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.ai-hypothesis-row__main {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.ai-hypothesis-row__main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-hypothesis-row__hint {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.ai-hypothesis-row__hint .icon {
  width: 13px;
}

.catalog-status {
  padding: 12px 13px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.45;
}

.catalog-status--error {
  color: #ae5e49;
  background: #f8dfd4;
}

.camera-view {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 320px;
  overflow: hidden;
  background: #10140f;
  border-radius: 18px;
}

.camera-view video {
  display: block;
  width: 100%;
  max-height: 55vh;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

.camera-view__status {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  color: #fff;
  background: rgba(0, 0, 0, .58);
  border-radius: 12px;
  font-size: 12px;
}

.camera-view__status .icon {
  color: var(--accent);
}

.camera-actions {
  display: flex;
  gap: 9px;
  margin-top: 14px;
}

.camera-actions button {
  flex: 1;
}

.camera-native-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 7px;
  cursor: pointer;
}

.camera-native-button .icon {
  width: 16px;
}

.camera-fallback-actions {
  display: flex;
  flex: 2;
  gap: 9px;
}

.camera-fallback-actions button {
  min-width: 0;
}

.camera-view__status--fallback {
  max-width: 300px;
  text-align: center;
}

.page-heading__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workout-list {
  overflow: hidden;
}

.workout-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.workout-row:last-child {
  border-bottom: 0;
}

.workout-row__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 11px;
}

.workout-row__icon .icon {
  width: 17px;
}

.workout-row__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.workout-row__main strong {
  font-size: 12px;
}

.workout-row__main span,
.workout-row__numbers span {
  color: var(--muted);
  font-size: 10px;
}

.workout-row__numbers {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.workout-row__numbers strong {
  font: 800 15px 'Manrope';
}

@media (max-width: 620px) {
  .page-heading__actions {
    align-items: flex-end;
    flex-direction: column;
  }
}

/* Keep the search field stable while results arrive from the server. */
#catalog-results {
  min-height: 0;
}

.quick-card--capture {
  cursor: pointer;
  user-select: none;
}

.catalog-status,
.catalog-results {
  scroll-margin-top: 18px;
}

@media (max-width: 620px) {
  .modal-backdrop {
    height: 100dvh;
    align-items: end;
  }

  .modal-sheet {
    max-height: calc(100dvh - env(safe-area-inset-top) - 10px);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .manual-form {
    padding-bottom: 8px;
  }

  #catalog-search-input {
    scroll-margin-top: 24px;
  }

  .catalog-results {
    max-height: min(34dvh, 300px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}
